Use six for python 2/3 compatibility

Replace usage of dict.keys() with six.iterkeys(dict)

Change-Id: Ia7c99ea202fd0800c43a079b5b3fd094e7e66adb