def getfqdn(name=''):
 name = name.strip()
 if ((not name) or (name == '0.0.0.0')):
  name = gethostname()
 try:
  (hostname, aliases, ipaddrs) = gethostbyaddr(name)
 except error:
  pass
 else:
  aliases.insert(0, hostname)
  for name in aliases:
   if ('.' in name):
    break
  else:
   name = hostname
 return name

def getfqdn ( name = '' ) : name = name . strip ( ) if ( ( not name ) or ( name == '0.0.0.0' ) ) : name = gethostname ( ) try : ( hostname , aliases , ipaddrs ) = gethostbyaddr ( name ) except error : pass else : aliases . insert ( 0 , hostname ) for name in aliases : if ( '.' in name ) : break else : name = hostname return name
get fully qualified domain name from name .