def bit_length(intval):
 assert isinstance(intval, INT_TYPES)
 if (intval >= 0):
  return (len(bin(intval)) - 2)
 else:
  return (len(bin(((- intval) - 1))) - 2)

def bit_length ( intval ) : assert isinstance ( intval , INT_TYPES ) if ( intval >= 0 ) : return ( len ( bin ( intval ) ) - 2 ) else : return ( len ( bin ( ( ( - intval ) - 1 ) ) ) - 2 )
return the number of bits necessary to represent integer intval .