Used Django utils SortedDict instead of stdlib's OrderedDict for
wider compatability.