Py3k compatible changes: call next(<generator>), not <generator>.next()