code: def lookup_reverse(ip_address):
      
      try:
          type(ipaddress.ip_address(ip_address))
      except ValueError:
          return {}
  
      record = reversename.from_address(ip_address)
      hostname = str(resolver.query(record, "PTR")[0])[:-1]
      return {'hostname': hostname}
docs: Perform a reverse lookup of IP address.