code: def recv(self):
          
          key, incoming = self.db.blpop(self.send_addr)
          d = json.loads(incoming.decode())
          uid, msg = d['id'], d['msg']
          def respond(response):
              self.db.rpush(self.recv_addr.format(id=uid), json.dumps(response))
          return msg, respond
docs: Returns:
              a tuple of `(dict, function)`, corresponding to the dequeued item and a function with which to send back a response.