isprime.py implementation