def FetchRequestsAndResponses(self, session_id, timestamp=None):
    subject = session_id.Add("state")
    requests = {}

    if timestamp is None:
      timestamp = (0, self.frozen_timestamp or rdfvalue.RDFDatetime().Now())

    # Get some requests.
    for predicate, serialized, _ in self.data_store.ResolvePrefix(
        subject, self.FLOW_REQUEST_PREFIX, token=self.token,
        limit=self.request_limit, timestamp=timestamp):

      request_id = predicate.split(":", 1)[1]
      requests[str(subject.Add(request_id))] = serialized

    # And the responses for them.
    response_data = dict(self.data_store.MultiResolvePrefix(
        requests.keys(), self.FLOW_RESPONSE_PREFIX,
        limit=self.response_limit, token=self.token,
        timestamp=timestamp))

    for urn, request_data in sorted(requests.items()):
      request = rdf_flows.RequestState(request_data)
      responses = []
      for _, serialized, _ in response_data.get(urn, []):
        responses.append(rdf_flows.GrrMessage(serialized))

      yield (request, sorted(responses, key=lambda msg: msg.response_id))

    if len(requests) >= self.request_limit:
      raise MoreDataException()
Provide order of indexes slowly detailing into the history
dataset/ETHPy150Open google/grr/grr/lib/queue_manager.py/QueueManager.FetchRequestsAndResponses--crossover with--dataset/ETHPy150Open pydata/vbench/vbench/utils.py/multires_order