def popitem(self, last=True):
if not self:<EOL><INDENT>raise KeyError('<STR_LIT>')<EOL><DEDENT>key = self._list_pop(-<NUM_LIT:1> if last else <NUM_LIT:0>)<EOL>value = self._pop(key)<EOL>return (key, value)<EOL>
Remove and return a ``(key, value)`` pair from the dictionary. If
last=True (default) then remove the *greatest* `key` from the
diciontary. Else, remove the *least* key from the dictionary.

If the dictionary is empty, calling `popitem` raises a
KeyError`.