code: def GetSortedEvents(self, time_range=None):
      
      filter_expression = None
      if time_range:
        filter_expression = []
  
        if time_range.start_timestamp:
          filter_expression.append(
              '_timestamp >= {0:d}'.format(time_range.start_timestamp))
  
        if time_range.end_timestamp:
          filter_expression.append(
              '_timestamp <= {0:d}'.format(time_range.end_timestamp))
  
        filter_expression = ' AND '.join(filter_expression)
  
      event_generator = self._GetAttributeContainers(
          self._CONTAINER_TYPE_EVENT, filter_expression=filter_expression,
          order_by='_timestamp')
  
      for event in event_generator:
        if hasattr(event, 'event_data_row_identifier'):
          event_data_identifier = identifiers.SQLTableIdentifier(
              'event_data', event.event_data_row_identifier)
          event.SetEventDataIdentifier(event_data_identifier)
  
          del event.event_data_row_identifier
  
        yield event
docs: Retrieves the events in increasing chronological order.
  
      Args:
        time_range (Optional[TimeRange]): time range used to filter events
            that fall in a specific period.
  
      Yield:
        EventObject: event.