'No dict.pop in Python 2.2, gotta reimplement it
>>> d = OrderedDict(((1, 3), (3, 2), (2, 1)))
>>> d.pop(3)
2
>>> d
OrderedDict([(1, 3), (2, 1)])
>>> d.pop(4)
Traceback (most recent call last):
KeyError: 4
>>> d.pop(4, 0)
0
>>> d.pop(4, 0, 1)
Traceback (most recent call last):
TypeError: pop expected at most 2 arguments, got 3'

def pop(self, key, *args):

    if (len(args) > 1):
        raise TypeError, ('pop    expected    at    most    2    arguments,    got    %s' % (len(args) + 1))
    if (key in self):
        val = self[key]
        del self[key]
    else:
        try:
            val = args[0]
        except IndexError:
            raise KeyError(key)
    return val
