def METHOD_NAME(self, msg, future=None, keep_alive=False):
    """Given a message and an associated `Future` object, store the future
    and send the message to the server."""
    self._msg_id += 1
    if future:
        handler = {
            "future": future,
        }
        # Handle table and view case here, because we can't reliably set
        # a custom resolve handler like we can do in JS.
        cmd = msg.get("cmd", None)
        if cmd == "view" or cmd == "table":
            handler["cmd"] = cmd
        self._handlers[self._msg_id] = handler
    elif keep_alive:
        handler = {
            "keep_alive": keep_alive,
        }
        if msg.get("callback_id"):
            handler["callback_id"] = msg["callback_id"]
        self._handlers[self._msg_id] = handler
    msg["id"] = self._msg_id
    return asyncio.ensure_future(self.send(msg))