def tempdir():
    """Create a temporary directory in a context manager."""
    td = tempfile.mkdtemp()
    try:
        yield td
    finally:
        shutil.rmtree(td)
Create a temporary directory in a context manager.
product/gradle-plugin/src/main/python/pip/_vendor/pep517/dirtools.py