Improve performance of Python's prime generator.