'Return prefix length from the decimal netmask.
Args:
ip_int: An integer, the IP address.
mask: The netmask.  Defaults to 32.
Returns:
An integer, the prefix length.'

def _prefix_from_ip_int(self, ip_int, mask=32):

    while mask:
        if ((ip_int & 1) == 1):
            break
        ip_int >>= 1
        mask -= 1
    return mask
