def pack_msg(method, msg, pickle_protocol=PICKLE_PROTOCOL):
    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())
Packs a method and message.
dataset/ETHPy150Open what-studio/profiling/profiling/remote/__init__.py/pack_msg