def netmask_bits(self):
        if not self.is_netmask():
            return self._module.width

        i_val = self._value
        numbits = 0

        while i_val > 0:
            if i_val & 1 == 1:
                break
            numbits += 1
            i_val >>= 1

        mask_length = self._module.width - numbits

        if not 0 <= mask_length <= self._module.width:
            raise ValueError('Unexpected mask length %d for address type!' \
                % mask_length)

        return mask_length
Modify an existing trade
dataset/ETHPy150Open drkjam/netaddr/netaddr/ip/__init__.py/IPAddress.netmask_bits--crossover with--dataset/ETHPy150Open jamesmawm/Mastering-Python-for-Finance-source-codes/B03898_08_codes/oandapy.py/EndpointsMixin.modify_trade