Use 'as' when catching exceptions instead of ','.

Since we are already using Python 2.6, this doesn't interfere with our
ability to be executed on earlier versions of Python.

This is also one little step closer to being compatible with Python 3. This
may or may never happen, who knows, as there are many other changes, but the
goal is to have code that is easier to read and maintain.
Fix whitespace and extra (unneeded) semicolons.

This makes code analysis tools happier with the code.
Don't overshadow python's own format builtin with a variable.
Remove unused variables.

They are assigned, but not checked. We should probably be checking if they
contain error codes.
Fix pep8's "E711 comparison to None should be 'if cond is not None:'".
Merge pull request #39 from rbrito/fixes/pep8-batch-01

Fixes for coding style and maintainabity