def DnsNameValid(dnsname):
 if ((not dnsname) or (not DNSNAME_RE.match(dnsname))):
  return False
 else:
  return True

def DnsNameValid ( dnsname ) : if ( ( not dnsname ) or ( not DNSNAME_RE . match ( dnsname ) ) ) : return False else : return True
tests whether a string is a valid dns name .