code: 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.")
docs: Retrieves information for an IP4 address.