>>> aa={'a':12, 'e':34, 'c':45, 'b':13, 'g':22, 'd':10}
>>> sorted(aa.items())
[('a', 12), ('b', 13), ('c', 45), ('d', 10), ('e', 34), ('g', 22)]
>>> dict(sorted(aa.items()))
{'a': 12, 'b': 13, 'c': 45, 'd': 10, 'e': 34, 'g': 22}
>>> from collections import OrderedDict
>>> OrderedDict(sorted(aa.items(), key=lambda x: x[0]))
OrderedDict([('a', 12), ('b', 13), ('c', 45), ('d', 10), ('e', 34), ('g', 22)])
>>> dict(OrderedDict(sorted(aa.items(), key=lambda x: x[0])))
{'a': 12, 'b': 13, 'c': 45, 'd': 10, 'e': 34, 'g': 22}