code: def format_time_event_json(self):
          
          time_event = {}
          time_event['time'] = self.timestamp
  
          if self.annotation is not None:
              time_event['annotation'] = self.annotation.format_annotation_json()
  
          if self.message_event is not None:
              time_event['message_event'] = \
                  self.message_event.format_message_event_json()
  
          return time_event
docs: Convert a TimeEvent object to json format.