Code cleanup of entire codebase

Branch consists of a few commits targeting specific issues and otherwise just a file by file cleanup of more or less everything. I've tried to mostly limit myself to style fixing, noting the places I spotted ref count problems with TODOs for now. Though this is not always the case, and should mostly be marked in the commit when I diverged doing extra changes...

I know this is going to be a pain to review, and the closest thing to a sane way of doing this will be a commit by commit work through.

Also before this goes in we need to check that:
- Any thing we malloc and give to PyObject_CallFunction or BuildValue needs to be freed by us.
- Any thing we get out of PyArg_Parse and friends with es, es#, et and et# needs to be freed by us.