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

Anti-pattern

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

Best practice

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