def RetrieveIPInfo(self, ip):
    if not ip:
      return (IPInfo.UNKNOWN, "No ip information.")
    ip_str = utils.SmartStr(ip)
    try:
      return self.cache.Get(ip_str)
    except KeyError:
      pass

    try:
      ip = ipaddr.IPAddress(ip_str)
    except __HOLE__:
      return (IPInfo.UNKNOWN, "No ip information.")
    if ip.version == 6:
      res = self.RetrieveIP6Info(ip)
    else:
      res = self.RetrieveIP4Info(ip)

    self.cache.Put(ip_str, res)
    return res
dataset/ETHPy150Open google/grr/grr/lib/ip_resolver.py/IPResolver.RetrieveIPInfo