a.popitem() remove and return an arbitrary (key, value) pair.

dict.popitem is useful to destructively iterate over a dictionary, as often used in set algorithms. If the dictionary is empty, calling [dict.popitem]] raises a KeyError.