checking if a key is in a dict is done with 'key in dict' not 'hasattr(dict, key)'