def validip6addr(address):
 try:
  socket.inet_pton(socket.AF_INET6, address)
 except (socket.error, AttributeError):
  return False
 return True

def validip6addr ( address ) : try : socket . inet_pton ( socket . AF_INET6 , address ) except ( socket . error , AttributeError ) : return False return True
returns true if address is a valid ipv6 address .