def isIPv6Address(addr):
    """
    Determine whether the given string represents an IPv6 address.

    @param addr: A string which may or may not be the hex
        representation of an IPv6 address.
    @type addr: C{str}

    @return: C{True} if C{addr} represents an IPv6 address, C{False}
        otherwise.
    @rtype: C{bool}
    """
    if '%' in addr:
        addr = addr.split('%', 1)[0]
    if not addr:
        return False
    try:
        # This might be a native implementation or the one from
        # twisted.python.compat.
        inet_pton(AF_INET6, addr)
    except (__HOLE__, error):
        return False
    return True
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/abstract.py/isIPv6Address