<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pack_msg(method, msg, pickle_protocol=PICKLE_PROTOCOL):
 """Packs a method and message."""

    dump = io.BytesIO()
    pickle.dump(msg, dump, pickle_protocol)
    size = dump.tell()
    return (struct.pack(METHOD_STRUCT_FORMAT, method) +
            struct.pack(SIZE_STRUCT_FORMAT, size) + dump.getvalue())