code: def get_slicing_config(
      eval_config: config_pb2.EvalConfig,
      weighted_example_column_to_use: Optional[str] = None,
  ) -> Dict[str, str]:
      """Util function that generates config for visualization.
  
      Args:
        eval_config: EvalConfig that contains example_weight_metric_key.
        weighted_example_column_to_use: Override for weighted example column in the
          slicing metrics browser.
  
      Returns:
        A dictionary containing configuration of the slicing metrics evalaution.
      """
      if eval_config.metrics_specs:
          default_column = example_count.EXAMPLE_COUNT_NAME
      else:
          # Legacy post_export_metric
          default_column = metric_keys.EXAMPLE_COUNT
  
      # For now we only support one candidate model, so pick first.
      model_spec = None
      if eval_config.model_specs:
          for spec in eval_config.model_specs:
              if not spec.is_baseline:
                  model_spec = spec
                  break
  
      if model_spec:
          if model_spec.example_weight_key:
              if eval_config.metrics_specs:
                  # Legacy post_export_metric
                  default_column = (
                      weighted_example_count.WEIGHTED_EXAMPLE_COUNT_NAME
                  )
              else:
                  default_column = metric_keys.EXAMPLE_WEIGHT
  
      return {
          "weightedExamplesColumn": weighted_example_column_to_use
          if weighted_example_column_to_use
          else default_column
      }
  
imports: import json
  import os
  from typing import Any, Dict, List, Optional, Tuple, Union
  from absl import logging
  from tensorflow_model_analysis.metrics import example_count
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import weighted_example_count
  from tensorflow_model_analysis.post_export_metrics import metric_keys
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.view import view_types
  from google.protobuf import json_format
label_desc: Use image node_id 7 for calling a global function with example usage: get_slicing_config(eval_config, weighted_example_column_to_use) and returns: dict