Deal with Django <1.7 using SortedDict wherein keys() is a generator, not a view