from typing import OrderedDict


def dict_to_ordered_dict(dict_in, key, reverse=True):
	"""
	Takes in a dict and returns an OrderedDict object sorted by a given key (in the form of a
	lambda expression).

	:param dict dict_in: a dictionary to be turned into an ordered dictionary.
	:param key: lambda expression.
	:param bool reverse: whether to sort the dict in reverse.
	:return: the dictionary input, ordered by the given key.
	:rtype: collections.OrderedDict
	"""
	return OrderedDict(sorted(dict_in.items(), key=key, reverse=reverse))