code: def get_json(self, timeout):
          
          (action, msg, kwargs) = yield from self.get(timeout)
          if hasattr(msg, "__json__"):
              msg = {"action": action, "event": msg.__json__()}
          else:
              msg = {"action": action, "event": msg}
          msg.update(kwargs)
          return json.dumps(msg, sort_keys=True)
docs: Get a message as a JSON