Sort keys of unordered_dict and store in OrderedDict.

def _ordered(generator, *args, **kwargs):
    """Sort keys of unordered_dict and store in OrderedDict."""
    unordered_dict = {k: v for k, v in generator(*args, **kwargs)}
    keys = sorted(list(dict(unordered_dict).keys()))
    result = OrderedDict()
    for key in keys:
        result[key] = unordered_dict[key]

    return result