(self)
return ((2 ** self._prefixlen) - 1) << locallen
Return netmask as an integer.

        >>> print hex(IP('195.185.0.0/16').netmask().int())
        0xFFFF0000L
Return netmask as an integer.
Return netmask as an integer .
def netmask(self):
        """Return netmask as an integer.

        >>> print hex(IP('195.185.0.0/16').netmask().int())
        0xFFFF0000L
        """

        # TODO: unify with prefixlenToNetmask?
        if self._ipversion == 4:
            locallen = 32 - self._prefixlen
        elif self._ipversion == 6:
            locallen = 128 - self._prefixlen
        else:
            raise ValueError("only IPv4 and IPv6 supported")

        return ((2 ** self._prefixlen) - 1) << locallen
def netmask ( self ) : # TODO: unify with prefixlenToNetmask? if self . _ipversion == 4 : locallen = 32 - self . _prefixlen elif self . _ipversion == 6 : locallen = 128 - self . _prefixlen else : raise ValueError ( "only IPv4 and IPv6 supported" ) return ( ( 2 ** self . _prefixlen ) - 1 ) << locallen