def RetrieveIP4Info(self, ip):
    if ip.is_private:
      return (IPInfo.INTERNAL, "Internal IP address.")
    try:
      # It's an external IP, let's try to do a reverse lookup.
      res = socket.getnameinfo((str(ip), 0), socket.NI_NAMEREQD)
      return (IPInfo.EXTERNAL, res[0])
    except (socket.error, socket.herror, socket.gaierror):
      return (IPInfo.EXTERNAL, "Unknown IP address.")
Retrieves information for an IP4 address.
dataset/ETHPy150Open google/grr/grr/lib/ip_resolver.py/IPResolver.RetrieveIP4Info