Python version agnostic way of getting the next item in the generator.