Django's template is not support Dict sort :(

I have write a new filter that support Dict sort in template

from django import template
from django.utils.datastructures import SortedDict

register = template.Library()

def listsort(value):
        if isinstance(value, dict):
            new_dict = SortedDict()
            key_list = value.keys()
            for key in key_list:
                new_dict[key] = value[key]
            return new_dict
        elif isinstance(value, list):
            new_list = list(value)
            return new_list
            return value
        listsort.is_safe = True