def host_is_ipv6(hostname):
 if ((not hostname) or (not isinstance(hostname, str))):
  return False
 if hostname.startswith('['):
  return True
 if (len(hostname.split(':')) > 2):
  return True
 return False

def host_is_ipv6 ( hostname ) : if ( ( not hostname ) or ( not isinstance ( hostname , str ) ) ) : return False if hostname . startswith ( '[' ) : return True if ( len ( hostname . split ( ':' ) ) > 2 ) : return True return False
detect if the hostname is an ipv6 host .