Fix pep8 errors

The recent pep8 upgrade is triggering new errors.

Change-Id: I73b1de3afed0a6979e0542e4c90cdb0bdb8b1122
Fix error: variable 'kw' referenced before assignment

Change-Id: Ife95d74bf645687dc4595b16434c88ee874c2f95
Closes-bug: #1311742
one more update for 0.6.1 change list

Change-Id: Iabb46b3996ed09f448a5d362347728591d2e664c