There\'s an existing function that ends in the following, where d is a dictionary:
d
return d.iteritems()
that returns an unsort
If you want to sort by the order that items were inserted instead of of the order of the keys, you should have a look to Python's collections.OrderedDict. (Python 3 only)