Clean up the number of pep8 violations in encoding.py

As almost all of the py files in the project seems to be free of pep8 violations, I just thought I would try to clean up encoding.py which seems to have the most pep8 violations.