def is_valid_ipv6(ip):
    try:
        socket.inet_pton(socket.AF_INET6, ip)
    except socket.error:  # not a valid address
        return False
    return True
Return True if the provided ip is a valid IPv6-address
dataset/ETHPy150Open openstack/swift/swift/common/ring/utils.py/is_valid_ipv6