merge recent fixes from main, pep8

Some of the changes in your PR have already been done in main, hence the merge. I applied flake8 and fixed a couple of typos. MySQL still problematic as is Python 2.5, not had much chance to dig into the detail.

Cheers