import socket


def verify_inet_protocol(inet_protocol):
    """Verify the ``INET_PROTOCOL`` from a proxy protocol line.

    Args:
        inet_protocol (bytes): The segment from the proxy protocol line.

    Returns:
        socket.AddressFamily: The address family enum associated with the
        protocol.

    Raises:
        ValueError: If ``inet_protocol`` does not match ``TPC{4,6}``.
    """
    if inet_protocol == b"TCP4":
        return socket.AF_INET
    if inet_protocol == b"TCP6":
        return socket.AF_INET6

    raise ValueError(f"Unhandled protocol type: {inet_protocol}")