Missing has_key() method in python2.7

I define the ```has_key()``` method for python2 compatibility, without affecting python3.