[PATCH v2 1/5] refactor code to comply with flake8 and isort