'Fetch only completed requests and responses up to a limit.'

def FetchCompletedResponses(self, session_id, timestamp=None, limit=10000):

    if (timestamp is None):
        timestamp = (0, (self.frozen_timestamp or rdfvalue.RDFDatetime.Now()))
    completed_requests = collections.deque(self.FetchCompletedRequests(session_id, timestamp=timestamp))
    total_size = 0
    while completed_requests:
        projected_total_size = total_size
        request_list = []
        while completed_requests:
            (request, status) = completed_requests.popleft()
            request_list.append(request)
            projected_total_size += status.response_id
            if (projected_total_size > limit):
                break
        for (request, responses) in self.data_store.ReadResponses(request_list, token=self.token):
            (yield (request, responses))
            total_size += len(responses)
            if (total_size > limit):
                raise MoreDataException()
