Apply PEP8 to factory.py