code: def write_dirpath(dirpath, strategy):
      """Returns the writing dir that should be used to save file distributedly.
  
      `dirpath` would be created if it doesn't exist.
  
      Args:
        dirpath: Original dirpath that would be used without distribution.
        strategy: The tf.distribute strategy object currently used.
  
      Returns:
        The writing dir path that should be used to save with distribution.
      """
      if strategy is None:
          # Infer strategy from `distribute_lib` if not given.
          strategy = distribute_lib.get_strategy()
      if strategy is None:
          # If strategy is still not available, this is not in distributed training.
          # Fallback to original dirpath.
          return dirpath
      if (
          not strategy.extended._in_multi_worker_mode()
      ):  # pylint: disable=protected-access
          return dirpath
      if strategy.extended.should_checkpoint:
          return dirpath
      # If this worker is not chief and hence should not save file, save it to a
      # temporary directory to be removed later.
      return _get_temp_dir(dirpath, strategy)
  
file_path: tensorflow/tensorflow/python/keras/distribute/distributed_file_utils.py
imports: import os
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.lib.io import file_io
label_desc: Use image node_id 4 for calling a global function with example usage: write_dirpath(dirpath, strategy) and returns: _get_temp_dir, dirpath, dirpath, dirpath