(self)
Return a list with values forming the reverse lookup.

        >>> IP('213.221.113.87/32').reverseNames()
        ['87.113.221.213.in-addr.arpa.']
        >>> IP('213.221.112.224/30').reverseNames()
        ['224.112.221.213.in-addr.arpa.', '225.112.221.213.in-addr.arpa.', '226.112.221.213.in-addr.arpa.', '227.112.221.213.in-addr.arpa.']
        >>> IP('127.0.0.0/24').reverseNames()
        ['0.0.127.in-addr.arpa.']
        >>> IP('127.0.0.0/23').reverseNames()
        ['0.0.127.in-addr.arpa.', '1.0.127.in-addr.arpa.']
        >>> IP('127.0.0.0/16').reverseNames()
        ['0.127.in-addr.arpa.']
        >>> IP('127.0.0.0/15').reverseNames()
        ['0.127.in-addr.arpa.', '1.127.in-addr.arpa.']
        >>> IP('128.0.0.0/8').reverseNames()
        ['128.in-addr.arpa.']
        >>> IP('128.0.0.0/7').reverseNames()
        ['128.in-addr.arpa.', '129.in-addr.arpa.']
Return a list with values forming the reverse lookup.
Return a list with values forming the reverse lookup .
def reverseNames(self):
        """Return a list with values forming the reverse lookup.

        >>> IP('213.221.113.87/32').reverseNames()
        ['87.113.221.213.in-addr.arpa.']
        >>> IP('213.221.112.224/30').reverseNames()
        ['224.112.221.213.in-addr.arpa.', '225.112.221.213.in-addr.arpa.', '226.112.221.213.in-addr.arpa.', '227.112.221.213.in-addr.arpa.']
        >>> IP('127.0.0.0/24').reverseNames()
        ['0.0.127.in-addr.arpa.']
        >>> IP('127.0.0.0/23').reverseNames()
        ['0.0.127.in-addr.arpa.', '1.0.127.in-addr.arpa.']
        >>> IP('127.0.0.0/16').reverseNames()
        ['0.127.in-addr.arpa.']
        >>> IP('127.0.0.0/15').reverseNames()
        ['0.127.in-addr.arpa.', '1.127.in-addr.arpa.']
        >>> IP('128.0.0.0/8').reverseNames()
        ['128.in-addr.arpa.']
        >>> IP('128.0.0.0/7').reverseNames()
        ['128.in-addr.arpa.', '129.in-addr.arpa.']

        """

        if self._ipversion == 4:
            ret = []
            # TODO: Refactor. Add support for IPint objects
            if self.len() < 2 ** 8:
                for x in self:
                    ret.append(x.reverseName())
            elif self.len() < 2 ** 16:
                for i in range(0, self.len(), 2 ** 8):
                    ret.append(self[i].reverseName()[2:])
            elif self.len() < 2 ** 24:
                for i in range(0, self.len(), 2 ** 16):
                    ret.append(self[i].reverseName()[4:])
            else:
                for i in range(0, self.len(), 2 ** 24):
                    ret.append(self[i].reverseName()[6:])
            return ret
        elif self._ipversion == 6:
            s = hex(self.ip)[2:].lower()
            if s[-1] == 'l':
                s = s[:-1]
            if self._prefixlen % 4 != 0:
                raise NotImplementedError(
                    "can't create IPv6 reverse names at sub nibble level")
            s = list(s)
            s.reverse()
            s = '.'.join(s)
            first_nibble_index = int(32 - (self._prefixlen / 4)) * 2
            return ["%s.ip6.int." % s[first_nibble_index:]]
        else:
            raise ValueError("only IPv4 and IPv6 supported")
def reverseNames ( self ) : if self . _ipversion == 4 : ret = [ ] # TODO: Refactor. Add support for IPint objects if self . len ( ) < 2 ** 8 : for x in self : ret . append ( x . reverseName ( ) ) elif self . len ( ) < 2 ** 16 : for i in range ( 0 , self . len ( ) , 2 ** 8 ) : ret . append ( self [ i ] . reverseName ( ) [ 2 : ] ) elif self . len ( ) < 2 ** 24 : for i in range ( 0 , self . len ( ) , 2 ** 16 ) : ret . append ( self [ i ] . reverseName ( ) [ 4 : ] ) else : for i in range ( 0 , self . len ( ) , 2 ** 24 ) : ret . append ( self [ i ] . reverseName ( ) [ 6 : ] ) return ret elif self . _ipversion == 6 : s = hex ( self . ip ) [ 2 : ] . lower ( ) if s [ - 1 ] == 'l' : s = s [ : - 1 ] if self . _prefixlen % 4 != 0 : raise NotImplementedError ( "can't create IPv6 reverse names at sub nibble level" ) s = list ( s ) s . reverse ( ) s = '.' . join ( s ) first_nibble_index = int ( 32 - ( self . _prefixlen / 4 ) ) * 2 return [ "%s.ip6.int." % s [ first_nibble_index : ] ] else : raise ValueError ( "only IPv4 and IPv6 supported" )