Fix flake8 errors

One correctness error found - using an undefined variable in debug mode
A few style errors found - inconsistent spacing mostly

This change fixes the above and adds a setup.cfg file that is used by
flake8 to ignore certain rules and modify others.  Feel free to tweak
this as desired, but style rules are becoming more and more useful as
this code grows.

Update: rebased and fixed all the style errors since this patch was
submitted.  Let's try to merge it soon so this doesn't become habbit :)

Change-Id: I5281ab1c5930240fa85f817483ef0fafc84711a3