Update code for new hacking/pep8/flake8 global requirements

A new hacking version was checked in [1] as a part of global
requirements. [1] ignored the rules, this patch enables the
rules again and fixes the code.

[1] https://review.openstack.org/#/c/100137/

Change-Id: If64cce56e9f1e349f05a4c706bfb28b5e557dab0
Closes-Bug: 1338918
Merge "Update code for new hacking/pep8/flake8 global requirements"