def _temp_dir(path):
    """
    Given a traversable dir, recursively replicate the whole tree
    to the file system in a context manager.
    """
    assert path.is_dir()
    with _temp_path(tempfile.TemporaryDirectory()) as temp_dir:
        yield _write_contents(temp_dir, path)

    Given a traversable dir, recursively replicate the whole tree
    to the file system in a context manager.
    
product/gradle-plugin/src/main/python/pkg_resources/_vendor/importlib_resources/_common.py