.has_key() was deprecated in Python 2. It is recommended to use the in operator instead.

Example

my_dict = {'hello': 'world'}
if 'hello' in my_dict:
    print('It works!')