vast cleanup

basic cleanup

mostly pep8 and pyflakes

there are still tons of these errors, though

```
W: 21,17: Redefining name 'Mappings' from outer scope (line 136) (redefined-outer-name)
R: 17, 4: Too many arguments (7/5) (too-many-arguments)
C: 51, 8: Invalid attribute name "Type" (invalid-name)
```

which I think should be fixed, but not by me