def order_dict_by(dict_, key_order):
    r
    dict_keys = set(dict_.keys())
    other_keys = dict_keys - set(key_order)
    key_order = it.chain(key_order, other_keys)
    sorted_dict = OrderedDict(
        (key, dict_[key]) for key in key_order if key in dict_keys
    )
    return sorted_dict