def _netmaskToPrefixlen(netmask):
    """Convert an Integer representing a netmask to a prefixlen.

    E.g. 0xffffff00 (255.255.255.0) returns 24
    """

    netlen = _count0Bits(netmask)
    masklen = _count1Bits(netmask)
    _checkNetmask(netmask, masklen)
    return masklen - netlen
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/foamext/IPy.py/_netmaskToPrefixlen/original