Implement is_prime in Python