<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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