Pep8/pyflakes cleanup of deprecated_api

* Reformats code better in line with hacking guidelines

Change-Id: I27fa5d7321c56155d1f1f3b6a35105e35e95e0f1
Merge "Pep8/pyflakes cleanup of deprecated_api"