Let's migrate to python 3.5! (it may have a [transformdict](http://legacy.python.org/dev/peps/pep-0455/) just for this).
Seriously, I think this is safe in py2, but in py3 `.keys` returns a view. Thus, this can (sometimes) raise a `RuntimeError`, so I suggest iterating over `list(dict.keys())`. I don't mind making the change in one of my py3-ish  PR.