(self)
return "unknown"
Return a description of the IP type ('PRIVATE', 'RESERVERD', etc).

        >>> print IP('127.0.0.1').iptype()
        PRIVATE
        >>> print IP('192.168.1.1').iptype()
        PRIVATE
        >>> print IP('195.185.1.2').iptype()
        PUBLIC
        >>> print IP('::1').iptype()
        LOOPBACK
        >>> print IP('2001:0658:022a:cafe:0200::1').iptype()
        ASSIGNABLE RIPE

        The type information for IPv6 is out of sync with reality.
Return a description of the IP type ('PRIVATE', 'RESERVERD', etc).
Return a description of the IP type ( PRIVATE RESERVERD etc ) .
def iptype(self):
        """Return a description of the IP type ('PRIVATE', 'RESERVERD', etc).

        >>> print IP('127.0.0.1').iptype()
        PRIVATE
        >>> print IP('192.168.1.1').iptype()
        PRIVATE
        >>> print IP('195.185.1.2').iptype()
        PUBLIC
        >>> print IP('::1').iptype()
        LOOPBACK
        >>> print IP('2001:0658:022a:cafe:0200::1').iptype()
        ASSIGNABLE RIPE

        The type information for IPv6 is out of sync with reality.
        """

        # this could be greatly improved

        if self._ipversion == 4:
            iprange = IPv4ranges
        elif self._ipversion == 6:
            iprange = IPv6ranges
        else:
            raise ValueError("only IPv4 and IPv6 supported")

        bits = self.strBin()
        for i in range(len(bits), 0, -1):
            if bits[:i] in iprange:
                return iprange[bits[:i]]
        return "unknown"
def iptype ( self ) : # this could be greatly improved if self . _ipversion == 4 : iprange = IPv4ranges elif self . _ipversion == 6 : iprange = IPv6ranges else : raise ValueError ( "only IPv4 and IPv6 supported" ) bits = self . strBin ( ) for i in range ( len ( bits ) , 0 , - 1 ) : if bits [ : i ] in iprange : return iprange [ bits [ : i ] ] return "unknown"