remove unused imports
use new style classes instead
prune trailing whitespace
pep8 fixes
pep8 in tests
use isinstance for type checking
Merge branch 'cleanups'

* cleanups:
  use isinstance for type checking
  pep8 in tests
  pep8 fixes
  prune trailing whitespace
  use new style classes instead
  remove unused imports