code: def set_tmp_dir(root, keep_dir):
      uniq_name = "{0}.{1}.{2}".format(
          int(time.time()), os.getpid(), uniq_id.gen8()
      )
      tmp_dir = os.path.join(root, uniq_name)
      fs.create_dirs(tmp_dir)
  
      old_tmp_dir = os.environ.get("TMPDIR")
      logger.debug("Set TMPDIR=%s instead of %s", tmp_dir, old_tmp_dir)
      os.environ["TMPDIR"] = tmp_dir
  
      global _startup_tmp_dir
      global _startup_tmp_dir_set
      if not _startup_tmp_dir_set:
          _startup_tmp_dir = old_tmp_dir
          _startup_tmp_dir_set = True
  
      if not keep_dir:
          _tmp_roots.append(tmp_dir)
  
file_path: catboost/library/python/tmp/__init__.py
imports: import logging
  import tempfile
  import time
  import os
  import shutil
  import contextlib
  import library.python.fs
  import library.python.unique_id
label_desc: Use image node_id 1 for calling a global function with example usage: set_tmp_dir(root, keep_dir) without return types