def _bit_size(number):
    if number < 0:
        raise ValueError('Only nonnegative numbers possible: %s' % number)

    if number == 0:
        return 0
    
    # This works, even with very large numbers. When using math.log(number, 2),
    # you'll get rounding errors and it'll fail.
    bits = 0
    while number:
        bits += 1
        number >>= 1

    return bits
Returns the number of bits required to hold a specific long number.
dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/rsa/common.py/_bit_size