from typing import OrderedDict


def dict_to_ordereddict(unordered_dict):
    """Converts a dict into an OrderedDict object sorrted by key

    gets the keys from the dict, sorts them and then inserts them in order into
    a new OrderedDict object

    Args:
        unordered_dict: the dictionary to sort

    Returns:
        An OrderedDict object with the keys/values from the input in key order

    """
    sorted_keys = sorted(unordered_dict.keys())
    ordered_dict = OrderedDict()
    for key in sorted_keys:
        ordered_dict[key] = unordered_dict[key]
    return ordered_dict