Fix flake8 warnings

This improves code format and readability according to pep8. Hope you will find this useful.