def _checkNetmask(netmask, masklen):
 num = long(netmask)
 bits = masklen
 while ((num & 1) == 0):
  num = (num >> 1)
  bits -= 1
  if (bits == 0):
   break
 while (bits > 0):
  if ((num & 1) == 0):
   raise ValueError(("Netmask %s can't be expressed as an prefix." % hex(netmask)))
  num = (num >> 1)
  bits -= 1

def _checkNetmask ( netmask , masklen ) : num = long ( netmask ) bits = masklen while ( ( num & 1 ) == 0 ) : num = ( num >> 1 ) bits -= 1 if ( bits == 0 ) : break while ( bits > 0 ) : if ( ( num & 1 ) == 0 ) : raise ValueError ( ( "Netmask %s can't be expressed as an prefix." % hex ( netmask ) ) ) num = ( num >> 1 ) bits -= 1
checks if a netmask is expressable as e prefixlen .