Adds flake8 and fixes flake8 problems