def is_prime(n, depth=<NUM_LIT:0>): 
n = _positive(n, "<STR_LIT>")<EOL>if n in _primes[:<NUM_LIT:5>]: return True<EOL>if n == <NUM_LIT:1> or n & <NUM_LIT:1> == <NUM_LIT:0>: return False<EOL>sqrt = int(sr(n))+<NUM_LIT:1><EOL>for p in _primes:<EOL><INDENT>if p > sqrt:<EOL><INDENT>return True<EOL><DEDENT>if n % p == <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if not prp(n): <EOL><INDENT>return False<EOL><DEDENT>start = (_depth+<NUM_LIT:1>) | <NUM_LIT:1> <EOL>end = depth+<NUM_LIT:1> if sqrt > depth > <NUM_LIT:1> else sqrt+<NUM_LIT:1><EOL>sstart = sr(start)<EOL>if _primes[-<NUM_LIT:1>] < sstart:<EOL><INDENT>sieve_max = nt._count <EOL><DEDENT>else:<EOL><INDENT>sieve_max = _primes.index(next_prime(sstart))<EOL><DEDENT>for i in range(start, end, <NUM_LIT:2>):<EOL><INDENT>for p in _primes[:sieve_max]: <EOL><INDENT>if i % p == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if n % i == <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT><DEDENT><DEDENT>return None if sqrt > depth > <NUM_LIT:1> else True<EOL>
\
Returns ... if a manual depth is given and there are no factors below that depth.
Tell me if you think of a better idea.