Fixed Python 3 compatiblity and cleaned up code for PEP 8 compliancy

Fairly straightforward Python 3 port, with code cleanups added, plus tox and wheel configuration thrown in.