Almost PEP8 compliant (except for line lengths) and some idiomatic stuff

PEP8 offenses:
 - 2-space tabs
 - alignment of equal signs (x   = 1)
 - whitespace around = in argument lists
 - whitespace before/after {/} in dictionaries
 - missing whitespace around % when string formatting
 - inconsistent spacing between classes (2 spaces is preferred)
 - multiple imports on one line

Idiomatic changes:
 - the first argument in @classmethods is usually named "cls"
 - comparison with None should be "is None" not "== None"