def METHOD_NAME(files: Sequence[str] = (), dirs: Sequence[str] = ()) -> Iterator[str]:
    unreferenced_files = tuple(path for path in files if not is_referenced(path))
    yield from unreferenced_files
    for path in dirs:
        if not any(filename.startswith(path + "/") for filename in unreferenced_files):
            # Skip paths where we don't have any unreferenced files any longer.
            continue
        if not is_referenced(path, path):
            yield path