def _gen_header(self, sequence, payloadtype):
        """ Create packet header. """
        protocol = bytearray.fromhex("00 34")
        source = bytearray.fromhex("42 52 4b 52")
        target = bytearray.fromhex("00 00 00 00 00 00 00 00")
        reserved1 = bytearray.fromhex("00 00 00 00 00 00")
        sequence = pack("<B", sequence)
        ack = pack(">B", 3)
        reserved2 = bytearray.fromhex("00 00 00 00 00 00 00 00")
        packet_type = pack("<H", payloadtype)
        reserved3 = bytearray.fromhex("00 00")

        # assemble header
        header = bytearray(protocol)
        header.extend(source)
        header.extend(target)
        header.extend(reserved1)
        header.extend(ack)
        header.extend(sequence)
        header.extend(reserved2)
        header.extend(packet_type)
        header.extend(reserved3)

        return header
Create packet header.