cleaning up whitespaces and performed flake8 checks on code