import struct


def _make_header(version: int, action: int, payload: bytes) -> bytes:
    """ Creates an IotorPacket header from the version, action and payload. """
    first_byte = (version << 4) | action
    header = struct.pack('<BH', first_byte, len(payload))
    return header + payload