def set_tempdir(tempdir: str = None):
    """Set the root directory for tempfiles.

    :param tempdir: new tempdir.
    """
    if tempdir is None:
        return

    tempdir = Path(tempdir).resolve()
    tempdir.mkdir(parents=True, exist_ok=True)
    # setting as string to be safe
    logger.debug("Setting tempdir to %s from %s", tempdir, tempfile.tempdir)
    tempfile.tempdir = str(tempdir)
Set the root directory for tempfiles.

    :param tempdir: new tempdir.
    
olive/common/utils.py