'Checks if there is a status message queued for a number of requests.'

def CheckRequestsForCompletion(self, requests, token=None):

    subjects = [r.session_id.Add('state') for r in requests]
    statuses_found = {}
    for (subject, result) in self.MultiResolvePrefix(subjects, self.FLOW_STATUS_PREFIX, token=token):
        for (predicate, _, _) in result:
            request_nr = int(predicate.split(':')[(-1)], 16)
            statuses_found.setdefault(subject, set()).add(request_nr)
    status_available = set()
    for r in requests:
        if (r.request_id in statuses_found.get(r.session_id.Add('state'), set())):
            status_available.add(r)
    return status_available
