[python] How can I check if a key exists in a dictionary?