code: def _prefix_from_ip_int(self, ip_int):
          
          prefixlen = self._max_prefixlen
          while prefixlen:
              if ip_int & 1:
                  break
              ip_int >>= 1
              prefixlen -= 1
  
          if ip_int == (1 << prefixlen) - 1:
              return prefixlen
          else:
              raise NetmaskValueError('Bit pattern does not match /1*0*/')
docs: Return prefix length from a bitwise netmask.
  
          Args:
              ip_int: An integer, the netmask in expanded bitwise format.
  
          Returns:
              An integer, the prefix length.
  
          Raises:
              NetmaskValueError: If the input is not a valid netmask.