def key_from_dict(kwargs):
    """
        Generator a key for a dictionary from a set of keyword arguments and their values. Used for the cache SQL
        lookups. frozenset, so that lookup order doesn't matter
    :param kwargs: Arguments to generate key from
    :return: frozenset of string keys generated from arguments
    """
    return frozenset(f"{x}|{kwargs[x]}" for x in kwargs)