def getprime(nbits):

    nbytes = int(math.ceil(nbits/8.))

    while True:
        integer = read_random_int(nbits)

        # Make sure it's odd
        integer |= 1

        # Test for primeness
        if is_prime(integer): break

        # Retry if not prime

    return integer
Returns a prime number of max. 'math.ceil(nbits/8)*8' bits. In
dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/rsa/_version133.py/getprime