import fnmatch


def ignore_paths(path_list, ignore_patterns, process=str):
    """
    Go through the `path_list` and ignore any paths that match the patterns in `ignore_patterns`
    :param path_list: List of file/directory paths.
    :param ignore_patterns: List of nukeignore patterns.
    :param process: Function to apply to every element in the path list before performing match.
    :return: The updated path list
    """
    for pattern in ignore_patterns:
        path_list = [
            n for n in path_list if not fnmatch.fnmatch(process(n), pattern)
        ]
    return path_list