dict.pop allows you to remove and return an item with the matching key from a dictionary. If a key doesn’t exist, you will get a KeyError.
dict.pop
KeyError
To avoid this error, add a default value to the second argument of dict.pop.
My previous tips on Python dictionary.