def METHOD_NAME(self, end):
    if not (self.type == 'start' and end.type == 'done'):
        return None
    if end.ts < self.ts:
        return None
    self.type = 'period'
    self.startTime = self.ts
    self.endTime = end.ts
    self.duration = self.endTime - self.startTime