use dict.iterkeys() instead of dict.viewkeys() for python-2.6 compatibility.