code: def _get_temp_dir(pool_folder_name, temp_folder=None):
      """Get the full path to a subfolder inside the temporary folder.
  
      Parameters
      ----------
      pool_folder_name : str
          Sub-folder name used for the serialization of a pool instance.
  
      temp_folder: str, optional
          Folder to be used by the pool for memmaping large arrays
          for sharing memory with worker processes. If None, this will try in
          order:
  
          - a folder pointed by the JOBLIB_TEMP_FOLDER environment
            variable,
          - /dev/shm if the folder exists and is writable: this is a
            RAMdisk filesystem available by default on modern Linux
            distributions,
          - the default system temporary folder that can be
            overridden with TMP, _TMPDIR or TEMP environment
            variables, typically /tmp under Unix operating systems.
  
      Returns
      -------
      pool_folder : str
         full path to the temporary folder
      use_shared_mem : bool
         whether the temporary folder is written to tmpfs
      """
      use_shared_mem = False
      if temp_folder is None:
          temp_folder = os.environ.get("JOBLIB_TEMP_FOLDER", None)
      if temp_folder is None:
          if os.path.exists(SYSTEM_SHARED_MEM_FS):
              try:
                  temp_folder = SYSTEM_SHARED_MEM_FS
                  pool_folder = os.path.join(
                      temp_folder, pool_folder_name
                  )
                  if not os.path.exists(pool_folder):
                      os.makedirs(pool_folder)
                  use_shared_mem = True
              except IOError:
                  # Missing rights in the the /dev/shm partition,
                  # fallback to regular temp folder.
                  temp_folder = None
      if temp_folder is None:
          # Fallback to the default tmp folder, typically /tmp
          temp_folder = tempfile.gettempdir()
      temp_folder = os.path.abspath(os.path.expanduser(temp_folder))
      pool_folder = os.path.join(temp_folder, pool_folder_name)
      return pool_folder, use_shared_mem
  
imports: from mmap import mmap
  import errno
  import os
  import stat
  import sys
  import threading
  import atexit
  import tempfile
  import shutil
  import warnings
  from time import sleep
  from pickle import whichmodule
  from pickle import Pickler
  from pickle import HIGHEST_PROTOCOL
  from io import BytesIO
  from ._multiprocessing_helpers import mp, assert_spawning
  from multiprocessing.pool import Pool
  from .numpy_pickle import load
  from .numpy_pickle import dump
  from .hashing import hash
  from .backports import make_memmap
label_desc: Use image node_id 2 for calling a global function with example usage: _get_temp_dir(pool_folder_name, temp_folder) and returns: pool_folder,  use_shared_mem