Fix all flake8 E* and F* errors

This was mostly unused modules or local variables.

Change-Id: I39f9598ba8b64101a10f80bae448d27272abeddd
Fix most of the hacking rules

Hacking rules: H302, H303, H304, H401, H404

Change-Id: I38e62696724a99c5ebe74d95d477999bd91a2c9a