Clean up the code with pyflakes and pep8