Make gen.py changes compliant with style conventions in PEP 8