code: def _is_chief():
      """Returns true if this is run in the master (chief) of training cluster."""
      tf_config = json.loads(
          os.environ.get(constants.TF_CONFIG_ENV) or "{}"
      )
  
      # If non distributed mode, current process should always behave as chief.
      if not tf_config or not tf_config.get("cluster", {}):
          return True
  
      task_type = tf_config["task"]["type"]
      task_index = tf_config["task"]["index"]
  
      # 'master' is a legacy notation of chief node in distributed training flock.
      return task_type == "chief" or (
          task_type == "master" and task_index == 0
      )
  
imports: import json
  import os
  from typing import Any, Dict, List
  import absl
  from tensorflow import estimator
  import tensorflow_model_analysis
  from tfx import types
  from tfx.components.trainer import constants
  from tfx.components.trainer import fn_args_utils
  from tfx.components.util import udf_utils
  from tfx.dsl.components.base import base_executor
  from tfx.dsl.io import fileio
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import deprecation_utils
  from tfx.utils import io_utils
  from tfx.utils import path_utils
  from tensorflow.python.lib.io import file_io
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: _is_chief() and returns: unknown, True