According to https://www.python.org/dev/peps/pep-0479/, the StopIteration exception should now be wrapped in try-catch.