Use 'in' instead of 'has_key()' for testing dictionary membership.
In PEP 0290, has_key() was deprecated in Python 2.2 and higher:
https://www.python.org/dev/peps/pep-0290/#testing-dictionary-membership
https://docs.python.org/2.2/whatsnew/node4.html
In Python 3, dict.has_key() was removed:
https://docs.python.org/3.0/whatsnew/3.0.html#builtins