I\'m writing a doctest for a function that outputs a dictionary. The doctest looks like
>>> my_function() {\'this\': \'is\', \'a\': \'dictionary\'}
turn it into a list via dict.items() and then sort it ...
>>> l = my_function().items() >>> l.sort() >>> l [('a', 'dictionary'), ('this', 'is')]