is this something that could be done more easily with [OrderedDict](http://docs.python.org/2/library/collections.html#collections.OrderedDict)?