def reverseNameFromIPAddress(address):
 try:
  socket.inet_pton(socket.AF_INET, address)
 except socket.error:
  return reverseNameFromIPv6Address(address)
 else:
  return reverseNameFromIPv4Address(address)

def reverseNameFromIPAddress ( address ) : try : socket . inet_pton ( socket . AF_INET , address ) except socket . error : return reverseNameFromIPv6Address ( address ) else : return reverseNameFromIPv4Address ( address )
return a reverse domain name for the given ip address .