code: def recv_callback(self, callback, **kwargs):
          
          payload = None
          timeout = self.get_timeout(**kwargs)
          full_timeout = timeout
          while timeout > 0.0:
              kwargs['timeout'] = timeout
              start = time.time()
              payload = self.recv(**kwargs)
              if callback(payload):
                  break
              payload = None
              stop = time.time()
              elapsed = stop - start
              timeout -= elapsed
  
          if not payload:
              raise IOError("recv_callback timed out in {}".format(full_timeout))
  
          return payload
docs: receive messages and validate them with the callback, if the callback 
          returns True then the message is valid and will be returned, if False then
          this will try and receive another message until timeout is 0