code: def format_result(input):
          
          items = list(iteritems(input))
          return OrderedDict(sorted(items, key=lambda x: x[0]))
docs: From: http://stackoverflow.com/questions/13062300/convert-a-dict-to-sorted-dict-in-python