import logging


def _exclude_functions(file_groups, exclude_functions):
    """
    Exclude nodes (functions) which match any of the exclude_functions

    :param list[Group] file_groups:
    :param list exclude_functions:
    :rtype: list[Group]
    """
    for function_name in exclude_functions:
        found = False
        for group in list(file_groups):
            for node in group.all_nodes():
                if node.token == function_name:
                    node.remove_from_parent()
                    found = True
        if not found:
            logging.warning(f"Could not exclude function '{function_name}' "
                            "because it was not found.")
    return file_groups