Add flake8 compliance and pre-build step

Fix #62 and make code flake8 compliant.