'D.popitem() -> (k, v). Remove and return a (key, value) pair with
the largest key; raise KeyError if D is empty.'

def popitem(self):

    try:
        key = self._sorted_keys.pop()
    except IndexError:
        raise KeyError('popitem():    dictionary    is    empty')
    else:
        return (key, dict.pop(self, key))
