PEP8 fixes and use new-style classes

Various PEP8 fixes, mostly indentation and white space.
Ensure each class is a new-style class (i.e. subclass from `(object)`).