remove trailing whitespaces
Make the code mostly flake8 compliant