adding assert500 and code cleanup with flake8

As stated in the title.