def inttobits(anint, width=None):
 remains = anint
 retreverse = []
 while remains:
  retreverse.append((remains & 1))
  remains = (remains >> 1)
 retreverse.reverse()
 ret = retreverse
 if (None != width):
  ret_head = ([0] * (width - len(ret)))
  ret = (ret_head + ret)
 return ret

def inttobits ( anint , width = None ) : remains = anint retreverse = [ ] while remains : retreverse . append ( ( remains & 1 ) ) remains = ( remains >> 1 ) retreverse . reverse ( ) ret = retreverse if ( None != width ) : ret_head = ( [ 0 ] * ( width - len ( ret ) ) ) ret = ( ret_head + ret ) return ret
produces an array of booleans representing the given argument as an unsigned integer .