def __setitem__(self, key, value):
    dict.__setitem__(self, key, value)
if key in self._order:
    self._order.remove(key)
self._order.append(key)

def __delitem__(self, key):
    dict.__delitem__(self, key)
self._order.remove(key)

def order(self):
    return self._order[:]
How do you retrieve items from a dictionary in the order that they're inserted?