nodes: 0, module; 1, function_definition; 2, function_name:list_events; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, expression_statement; 15, if_statement; 16, if_statement; 17, if_statement; 18, if_statement; 19, if_statement; 20, if_statement; 21, return_statement; 22, identifier:source; 23, None; 24, identifier:severity; 25, None; 26, identifier:text_filter; 27, None; 28, identifier:start; 29, None; 30, identifier:stop; 31, None; 32, identifier:page_size; 33, integer:500; 34, identifier:descending; 35, False; 36, comment:"""
          Reads events between the specified start and stop time.
  
          Events are sorted by generation time, source, then sequence number.
  
          :param str source: The source of the returned events.
          :param str severity: The minimum severity level of the returned events.
                               One of ``INFO``, ``WATCH``, ``WARNING``, ``DISTRESS``,
                               ``CRITICAL`` or ``SEVERE``.
          :param str text_filter: Filter the text message of the returned events
          :param ~datetime.datetime start: Minimum start date of the returned events (inclusive)
          :param ~datetime.datetime stop: Maximum start date of the returned events (exclusive)
          :param int page_size: Page size of underlying requests. Higher values imply
                                less overhead, but risk hitting the maximum message size limit.
          :param bool descending: If set to ``True`` events are fetched in reverse
                                  order (most recent first).
          :rtype: ~collections.Iterable[.Event]
          """; 37, assignment; 38, comparison_operator:source is not None; 39, block; 40, comparison_operator:page_size is not None; 41, block; 42, comparison_operator:severity is not None; 43, block; 44, comparison_operator:start is not None; 45, block; 46, comparison_operator:stop is not None; 47, block; 48, comparison_operator:text_filter is not None; 49, block; 50, call; 51, identifier:params; 52, dictionary; 53, identifier:source; 54, None; 55, expression_statement; 56, identifier:page_size; 57, None; 58, expression_statement; 59, identifier:severity; 60, None; 61, expression_statement; 62, identifier:start; 63, None; 64, expression_statement; 65, identifier:stop; 66, None; 67, expression_statement; 68, identifier:text_filter; 69, None; 70, expression_statement; 71, attribute; 72, argument_list; 73, pair; 74, assignment; 75, assignment; 76, assignment; 77, assignment; 78, assignment; 79, assignment; 80, identifier:pagination; 81, identifier:Iterator; 82, keyword_argument; 83, keyword_argument; 84, keyword_argument; 85, keyword_argument; 86, keyword_argument; 87, keyword_argument; 88, string; 89, conditional_expression:'desc' if descending else 'asc'; 90, subscript; 91, identifier:source; 92, subscript; 93, identifier:page_size; 94, subscript; 95, identifier:severity; 96, subscript; 97, call; 98, subscript; 99, call; 100, subscript; 101, identifier:text_filter; 102, identifier:client; 103, attribute; 104, identifier:path; 105, call; 106, identifier:params; 107, identifier:params; 108, identifier:response_class; 109, attribute; 110, identifier:items_key; 111, string; 112, identifier:item_mapper; 113, identifier:Event; 114, string_content:order; 115, string; 116, identifier:descending; 117, string; 118, identifier:params; 119, string; 120, identifier:params; 121, string; 122, identifier:params; 123, string; 124, identifier:params; 125, string; 126, identifier:to_isostring; 127, argument_list; 128, identifier:params; 129, string; 130, identifier:to_isostring; 131, argument_list; 132, identifier:params; 133, string; 134, identifier:self; 135, identifier:_client; 136, attribute; 137, argument_list; 138, identifier:rest_pb2; 139, identifier:ListEventsResponse; 140, string_content:event; 141, string_content:desc; 142, string_content:asc; 143, string_content:source; 144, string_content:limit; 145, string_content:severity; 146, string_content:start; 147, identifier:start; 148, string_content:stop; 149, identifier:stop; 150, string_content:q; 151, string; 152, identifier:format; 153, attribute; 154, string_content:/archive/{}/events; 155, identifier:self; 156, identifier:_instance
code: def list_events(self, source=None, severity=None, text_filter=None,
                      start=None, stop=None, page_size=500, descending=False):
          """
          Reads events between the specified start and stop time.
  
          Events are sorted by generation time, source, then sequence number.
  
          :param str source: The source of the returned events.
          :param str severity: The minimum severity level of the returned events.
                               One of ``INFO``, ``WATCH``, ``WARNING``, ``DISTRESS``,
                               ``CRITICAL`` or ``SEVERE``.
          :param str text_filter: Filter the text message of the returned events
          :param ~datetime.datetime start: Minimum start date of the returned events (inclusive)
          :param ~datetime.datetime stop: Maximum start date of the returned events (exclusive)
          :param int page_size: Page size of underlying requests. Higher values imply
                                less overhead, but risk hitting the maximum message size limit.
          :param bool descending: If set to ``True`` events are fetched in reverse
                                  order (most recent first).
          :rtype: ~collections.Iterable[.Event]
          """
          params = {
              'order': 'desc' if descending else 'asc',
          }
          if source is not None:
              params['source'] = source
          if page_size is not None:
              params['limit'] = page_size
          if severity is not None:
              params['severity'] = severity
          if start is not None:
              params['start'] = to_isostring(start)
          if stop is not None:
              params['stop'] = to_isostring(stop)
          if text_filter is not None:
              params['q'] = text_filter
  
          return pagination.Iterator(
              client=self._client,
              path='/archive/{}/events'.format(self._instance),
              params=params,
              response_class=rest_pb2.ListEventsResponse,
              items_key='event',
              item_mapper=Event,
          )