import socket


def create_mapped_address(ipaddr: str, port: int) -> bytes:
    """
    The MAPPED-ADDRESS attribute indicates a reflexive transport address of the client
    The first 8 bits must be set to 0 (align 32-bit boundaries)

        * 8 bits [1 byte] zero (align 32-bit boundaries)
        * 8 bits [1 byte] family
            - 0x01: IPv4
            - 0x02: IPv6
        * 16 bits [2 bytes] port
        * 32/128 bits [4/16 bytes] IPv4/IPv6 address
    """
    zero = bytes.fromhex('00')
    family = bytes.fromhex('01')
    port_byte = bytes.fromhex(format(port, '04x'))
    ipaddr_byte = socket.inet_aton(ipaddr)
    return zero + family + port_byte + ipaddr_byte