From: http://stackoverflow.com/questions/13062300/convert-a-dict-to-sorted-dict-in-python

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