def from_address(text):
 try:
  parts = list(dns.ipv6.inet_aton(text).encode('hex_codec'))
  origin = ipv6_reverse_domain
 except:
  parts = [('%d' % ord(byte)) for byte in dns.ipv4.inet_aton(text)]
  origin = ipv4_reverse_domain
 parts.reverse()
 return dns.name.from_text('.'.join(parts), origin=origin)

def from_address ( text ) : try : parts = list ( dns . ipv6 . inet_aton ( text ) . encode ( 'hex_codec' ) ) origin = ipv6_reverse_domain except : parts = [ ( '%d' % ord ( byte ) ) for byte in dns . ipv4 . inet_aton ( text ) ] origin = ipv4_reverse_domain parts . reverse ( ) return dns . name . from_text ( '.' . join ( parts ) , origin = origin )
convert an ipv4 or ipv6 address in textual form into a name object whose value is the reverse-map domain name of the address .