Sort the keys and don't use OrderedDict as we have to use 2.6.6