use dict.keys() instead of dict.iterkeys() to support both python 2 and 3

use dict.keys() instead of dict.iterkeys() to support both python 2 and 3