parameters: (self)
docstring: Return the value for reverse lookup/PTR records as RFC 2317 look alike.
  
          RFC 2317 is an ugly hack which only works for sub-/24 e.g. not
          for /23. Do not use it. Better set up a zone for every
          address. See reverseName for a way to achieve that.
  
          >>> print(IP('195.185.1.1').reverseName())
          1.1.185.195.in-addr.arpa.
          >>> print(IP('195.185.1.0/28').reverseName())
          0-15.1.185.195.in-addr.arpa.
          >>> IP('::1:2').reverseName()
          '2.0.0.0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.'
          >>> IP('ff02::/64').reverseName()
          '0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa.'
docstring_summary: Return the value for reverse lookup/PTR records as RFC 2317 look alike.
docstring_tokens: Return the value for reverse lookup / PTR records as RFC 2317 look alike .
function: def reverseName(self):
          """Return the value for reverse lookup/PTR records as RFC 2317 look alike.
  
          RFC 2317 is an ugly hack which only works for sub-/24 e.g. not
          for /23. Do not use it. Better set up a zone for every
          address. See reverseName for a way to achieve that.
  
          >>> print(IP('195.185.1.1').reverseName())
          1.1.185.195.in-addr.arpa.
          >>> print(IP('195.185.1.0/28').reverseName())
          0-15.1.185.195.in-addr.arpa.
          >>> IP('::1:2').reverseName()
          '2.0.0.0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.'
          >>> IP('ff02::/64').reverseName()
          '0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa.'
          """
  
          if self._ipversion == 4:
              s = self.strFullsize(0)
              s = s.split('.')
              s.reverse()
              first_byte_index = int(4 - (self._prefixlen // 8))
              if self._prefixlen % 8 != 0:
                  nibblepart = "%s-%s" % (s[3-(self._prefixlen // 8)], intToIp(self.ip + self.len() - 1, 4).split('.')[-1])
                  nibblepart += '.'
              else:
                  nibblepart = ""
  
              s = '.'.join(s[first_byte_index:])
              return "%s%s.in-addr.arpa." % (nibblepart, s)
  
          elif self._ipversion == 6:
              ipv4 = self._getIPv4Map()
              if ipv4 is not None:
                  return ipv4.reverseName()
              s = '%032x' % self.ip
              if self._prefixlen % 4 != 0:
                  nibblepart = "%s-%x" % (s[self._prefixlen:], self.ip + self.len() - 1)
                  nibblepart += '.'
              else:
                  nibblepart = ""
              s = list(s)
              s.reverse()
              s = '.'.join(s)
              first_nibble_index = int(32 - (self._prefixlen // 4)) * 2
              return "%s%s.ip6.arpa." % (nibblepart, s[first_nibble_index:])
          else:
              raise ValueError("only IPv4 and IPv6 supported")
function_tokens: def reverseName ( self ) : if self . _ipversion == 4 : s = self . strFullsize ( 0 ) s = s . split ( '.' ) s . reverse ( ) first_byte_index = int ( 4 - ( self . _prefixlen // 8 ) ) if self . _prefixlen % 8 != 0 : nibblepart = "%s-%s" % ( s [ 3 - ( self . _prefixlen // 8 ) ] , intToIp ( self . ip + self . len ( ) - 1 , 4 ) . split ( '.' ) [ - 1 ] ) nibblepart += '.' else : nibblepart = "" s = '.' . join ( s [ first_byte_index : ] ) return "%s%s.in-addr.arpa." % ( nibblepart , s ) elif self . _ipversion == 6 : ipv4 = self . _getIPv4Map ( ) if ipv4 is not None : return ipv4 . reverseName ( ) s = '%032x' % self . ip if self . _prefixlen % 4 != 0 : nibblepart = "%s-%x" % ( s [ self . _prefixlen : ] , self . ip + self . len ( ) - 1 ) nibblepart += '.' else : nibblepart = "" s = list ( s ) s . reverse ( ) s = '.' . join ( s ) first_nibble_index = int ( 32 - ( self . _prefixlen // 4 ) ) * 2 return "%s%s.ip6.arpa." % ( nibblepart , s [ first_nibble_index : ] ) else : raise ValueError ( "only IPv4 and IPv6 supported" )