def _is_ipv6_enabled():
 if socket.has_ipv6:
  sock = None
  try:
   sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
   sock.bind((HOSTv6, 0))
   return True
  except socket.error:
   pass
  finally:
   if sock:
    sock.close()
 return False

def _is_ipv6_enabled ( ) : if socket . has_ipv6 : sock = None try : sock = socket . socket ( socket . AF_INET6 , socket . SOCK_STREAM ) sock . bind ( ( HOSTv6 , 0 ) ) return True except socket . error : pass finally : if sock : sock . close ( ) return False
check whether ipv6 is enabled on this host .