def deactivate(self, index=None):
    if (index is None):
        for i in range(len(self.activity)):
            self.deactivate(i)
        return
    if self.activity[index]:
        attr = {'lifetime': self.activity[index], 'level': index}
        self.activities.append(attr)
    self.activity[index] = []
def deactivate(self, index=None):
    if (index is None):
        for i in range(len(self.activity)):
            self.deactivate(i)
        return
    if self.activity[index]:
        attr = {'lifetime': self.activity[index], 'level': index}
        self.activities.append(attr)
    self.activity[index] = []