from typing import OrderedDict


def invert_dict(d):
    """
    Inverts a dictionary: keys become values.

    This is an instance of an OrderedDict, and so the new keys are
    sorted.

    :Args:
        d: dict
    """
    inv_dict = dict([[v,k] for k,v in d.items()])
    sortkeys = sorted(inv_dict.keys())
    inv_dict = OrderedDict([(k,inv_dict[k]) for k in sortkeys])
    return inv_dict