Fix UnicodeDecodeError when reading files with utf8

plus the usual OCD PEP8 fixes