def METHOD_NAME(session_work_dir: Path, request: FixtureRequest) -> typing.Generator[Path, None, None]:
    copy_to = request.node.name + '_idf'
    # allow overriding the destination via pytest.mark.idf_copy()
    mark = request.node.get_closest_marker('idf_copy')
    if mark:
        copy_to = mark.args[0]
    path_from = EXT_IDF_PATH
    path_to = session_work_dir / copy_to
    # if the new directory inside the original directory,
    # make sure not to go into recursion.
    ignore = shutil.ignore_patterns(
        path_to.name,
        # also ignore the build directories which may be quite large
        '**/build')
    logging.debug(f'copying {path_from} to {path_to}')
    shutil.copytree(path_from, path_to, ignore=ignore, symlinks=True)
    orig_idf_path = os.environ['IDF_PATH']
    os.environ['IDF_PATH'] = str(path_to)
    yield Path(path_to)
    os.environ['IDF_PATH'] = orig_idf_path
    if should_clean_test_dir(request):
        logging.debug('cleaning up work directory after a successful test: {}'.format(path_to))
        shutil.rmtree(path_to, ignore_errors=True)