def handleresponses(self):
    # try to get a response.
    self.rpc.fetch_responses();
    ans = self.rpc.first_response();
    if not ans:
      return False

    (req_id, msg_id, msg_body) = ans
    # iterate through resp_idx, and try and find a handler.
    handled = False;
    for i in range(self.nolevels):
      for responder in self.resp_idx[i]:
        if responder.isReqIdMatch(req_id) and responder.isMsgIdMatch(msg_id):
          # match! handle it.
          handled = responder.handlemsg(req_id, msg_id, msg_body, self.rpc, self.parser)
        
        if handled:
          break
      # break out of second loop too.
      if handled:
        break

    # try generic handler 
    if not handled:
      for responder in self.gen_responders:
        handled = responder.handlemsg(req_id, msg_id, msg_body, self.rpc, self.parser)
        if handled:
          break

    # if still not handled - stick in queue.
    self.other_msgs.append( (req_id, msg_id, msg_body) )
    return True
dataset/ETHPy150Open drbob/pyrs/pyrs/responder.py/RsResponderGroup.handleresponses/original