import struct


def pack_message(opcode:int, message:str) -> bytes:
    """
    Pack message into IPC frame.
    """

    # [UINT opcode][UINT length][payload]
    header = struct.pack('<II', opcode, len(message))
    return header + message.encode("utf-8")