def METHOD_NAME(self, msg):
    """ Send a message to the kernel and handle a reply.
    """
    kernel = self.kernel
    if kernel is None:
        raise RuntimeError('Cannot send request. No kernel exists.')
    stream = DummySocket()
    self.session.send(stream, msg)
    msg_parts = stream.recv_multipart()
    kernel.dispatch_shell(stream, msg_parts)
    idents, reply_msg = self.session.recv(stream, copy=False)
    self.shell_channel.call_handlers_later(reply_msg)