code: def get_output_filepath(
      filepath: str, strategy: Optional[tf.distribute.Strategy]
  ) -> str:
      """Gets filepaths for different workers to resolve conflict of MWMS.
  
      Example usage:
  
      ```python
      strategy = get_strategy("MultiWorkerMirroredStrategy")
      worker_filepath = get_output_filepath("model/", strategy)
      ```
  
      Args:
        filepath: Path to output model files.
        strategy: Distributed training strategy is used.
  
      Returns:
        Output path that is compatible with strategy and the specific worker.
      """
      if isinstance(
          strategy, tf.distribute.MultiWorkerMirroredStrategy
      ):
          task_type, task_id = (
              strategy.cluster_resolver.task_type,
              strategy.cluster_resolver.task_id,
          )
          if task_type is not None and task_type != "chief":
              basepath = (
                  "workertemp_" + str(task_id)
                  if task_id is not None
                  else ""
              )
              temp_dir = os.path.join(filepath, basepath)
              tf.io.gfile.makedirs(temp_dir)
              return temp_dir
      return filepath
  
file_path: ranking/tensorflow_ranking/python/keras/strategy_utils.py
imports: import os
  from typing import Any, Optional, Union
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: get_output_filepath(filepath, strategy) and returns: filepath, temp_dir