def find_unassigned(cl_list, cg_list, key1, key2):
    """ Compare to list of dictionaries based on individual dict keys
    and return list of elements based on key1

    To create a database table analogy you can think of key1 and key2 as primary keys in the lists

    :param cl_list: first list of dictionaries
    :param cg_list: second list of dictionaries
    :param key1: dictionary key in first list
    :param key2: dictionary key in second list
    :return missing: list of key1 elements not found in second dict
    """
    for el1 in cl_list:
        found = False
        for el2 in cg_list:
            el1['found'] = False
            if el1[key1] == el2[key2]:
                found = True
                el1['found'] = True
            if found:
                break
    missing = []
    for el1 in cl_list:
        if "found" in el1:
            if el1['found'] == False:
                missing.append(el1[key1])

    return missing