Use py2/py3 compatible generator syntax

In py2, generators have gen.next() methods.  In py3, it's gen.__next__().  Using next(gen) works in both versions.
Merge pull request #4 from akaptur/generator-syntax

Use py2/py3 compatible generator syntax