@contextlib.contextmanager
def mkdtemp_scoped(prefix = None):

    # provide a reasonable default prefix
    if prefix is None:
        prefix = "%s." % pwd.getpwuid(os.getuid())[0]

    # create the context
    path = None

    try:
        path = tempfile.mkdtemp(prefix = prefix)

        yield path
    finally:
        if path is not None:
            shutil.rmtree(path, ignore_errors = True)
generates a single graph
dataset/ETHPy150Open borg-project/borg/borg/util.py/mkdtemp_scoped--crossover with--dataset/ETHPy150Open redhat-cip/edeploy/tools/grapher/reports/basereport.py/BaseReport._generate_graph