def isPrime(N, false_positive_prob=1e-6, randfunc=None):
    """isPrime(N:long, false_positive_prob:float, randfunc:callable):bool
    Return true if N is prime.

    The optional false_positive_prob is the statistical probability
    that true is returned even though it is not (pseudo-prime).
    It defaults to 1e-6 (less than 1:1000000).
    Note that the real probability of a false-positive is far less. This is
    just the mathematically provable limit.

    If randfunc is omitted, then Random.new().read is used.
    """
    if _fastmath is not None:
        return _fastmath.isPrime(long(N), false_positive_prob, randfunc)

    if N < 3 or N & 1 == 0:
        return N == 2
    for p in sieve_base:
        if N == p:
            return 1
        if N % p == 0:
            return 0

    rounds = int(math.ceil(-math.log(false_positive_prob)/math.log(4)))
    return _rabinMillerTest(N, rounds, randfunc)


# Improved conversion functions contributed by Barry Warsaw, after
# careful benchmarking
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Util/number.py/isPrime/original