def is_ipv6(ip_str):
 try:
  addr = ipaddr.IPAddress(ip_str)
  return (addr.version == 6)
 except:
  return False

def is_ipv6 ( ip_str ) : try : addr = ipaddr . IPAddress ( ip_str ) return ( addr . version == 6 ) except : return False
validate whether given string is ipv6 .