def intfrombits(bits):
 ret = 0
 lsb_first = [b for b in bits]
 lsb_first.reverse()
 for bit_index in range(len(lsb_first)):
  if lsb_first[bit_index]:
   ret = (ret | (1 << bit_index))
 return ret

def intfrombits ( bits ) : ret = 0 lsb_first = [ b for b in bits ] lsb_first . reverse ( ) for bit_index in range ( len ( lsb_first ) ) : if lsb_first [ bit_index ] : ret = ( ret | ( 1 << bit_index ) ) return ret
given a list of boolean values .