def prep_message(msg):
    """
    Add the size header
    """
    if six.PY3:
        msg_out = msg.as_string().encode("utf-8")
    else:
        msg_out = msg.as_string()

    our_len = len(msg_out) + 4
    size = struct.pack('>L', our_len)
    # why the hell is this "bytes" on python3?

    return size + msg_out