Problem of unsorted dicts solved

by using sorted(YourDictionary.iteritems()) function