flake8 formatting changes, improvements from Brno

I made improvements based on cooperation in Brno, and controlled all
code by flake 8 for all formatting mistakes, except of too long lines.