def send_message(msg: 'EFBMsg') -> Optional['EFBMsg']:
    """
    Deliver a message to the destination channel.

    Args:
        msg (EFBMsg): The message

    Returns:
        The message sent by the destination channel,
        includes the updated message ID from there.
        Returns ``None`` if the message is not sent.
    """
    global middlewares, master, slaves

    if msg is None:
        return

    # Go through middlewares
    for i in middlewares:
        m = i.process_message(msg)
        if m is None:
            return None
        # for mypy type check
        assert m is not None
        msg = m

    msg.verify()

    if msg.deliver_to.channel_id == master.channel_id:
        return master.send_message(msg)
    elif msg.deliver_to.channel_id in slaves:
        return slaves[msg.deliver_to.channel_id].send_message(msg)
    else:
        raise EFBChannelNotFound(msg)