Pyflakes on utilities

Mostly just unused names. There are still a few false positives from globals
and some logic that pyflakes can't handle.
Pyflakes on utilities tests

I left the unused imports that represented things that should be tested.

One change was a variable name typo (in code_quality). The rest were unused
variables or imports.