def pack_bits(bits):
 packed = 0
 level = 0
 for bit in bits:
  if bit:
   packed += (2 ** level)
  level += 1
 return packed

def pack_bits ( bits ) : packed = 0 level = 0 for bit in bits : if bit : packed += ( 2 ** level ) level += 1 return packed
convert a bit tuple into a int .