def getHost(ip):
 try:
  return socket.gethostbyaddr(ip)[0]
 except Exception:
  return False

def getHost ( ip ) : try : return socket . gethostbyaddr ( ip ) [ 0 ] except Exception : return False
this method returns the true host name for a given ip address .