Fix flake8 errors and enable in travis

Clean up whitespace, extra imports, redefined symbols, and other errors and
warnings reported by flake8.

Add flake8 to the commands run by travis.

Change-Id: Id3bdea24cad61c13c163970a4a13bc47e4ece553