code: def convert_slicing_metrics_to_ui_input(
      slicing_metrics: List[
          Tuple[
              slicer.SliceKeyOrCrossSliceKeyType,
              view_types.MetricsByOutputName,
          ]
      ],
      slicing_column: Optional[str] = None,
      slicing_spec: Optional[slicer.SingleSliceSpec] = None,
      output_name: str = "",
      multi_class_key: str = "",
  ) -> Optional[List[Dict[str, Any]]]:
      """Renders the Fairness Indicator view.
  
      Args:
        slicing_metrics: tfma.EvalResult.slicing_metrics.
        slicing_column: The slicing column to to filter results. If both
          slicing_column and slicing_spec are None, show all eval results.
        slicing_spec: The slicing spec to filter results. If both slicing_column and
          slicing_spec are None, show all eval results.
        output_name: The output name associated with metric (for multi-output
          models).
        multi_class_key: The multi-class key associated with metric (for multi-class
          models).
  
      Returns:
        A list of dicts for each slice, where each dict contains keys 'sliceValue',
        'slice', and 'metrics'.
  
      Raises:
        ValueError if no related eval result found or both slicing_column and
        slicing_spec are not None.
      """
      if slicing_column and slicing_spec:
          raise ValueError(
              'Only one of the "slicing_column" and "slicing_spec" parameters '
              "can be set."
          )
      if slicing_column:
          slicing_spec = slicer.SingleSliceSpec(
              columns=[slicing_column]
          )
  
      data = []
      for slice_key, metric_value in slicing_metrics:
          if (
              metric_value is not None
              and output_name in metric_value
              and multi_class_key in metric_value[output_name]
          ):
              metrics = metric_value[output_name][multi_class_key]
              # To add evaluation data for cross slice comparison.
              if slicer.is_cross_slice_key(slice_key):
                  _add_cross_slice_key_data(slice_key, metrics, data)
              # To add evaluation data for regular slices.
              elif (
                  slicing_spec is None
                  or not slice_key
                  or slicing_spec.is_slice_applicable(slice_key)
              ):
                  data.append(
                      {
                          "sliceValue": stringify_slice_key_value(
                              slice_key
                          ),
                          "slice": slicer.stringify_slice_key(
                              slice_key
                          ),
                          "metrics": metrics,
                      }
                  )
      if not data:
          raise ValueError(
              'No eval result found for output_name:"%s" and '
              'multi_class_key:"%s" and slicing_column:"%s" and slicing_spec:"%s".'
              % (
                  output_name,
                  multi_class_key,
                  slicing_column,
                  slicing_spec,
              )
          )
      return data
  
file_path: model-analysis/tensorflow_model_analysis/addons/fairness/view/widget_view.py
imports: from typing import Optional, Dict, Callable, Any, List, Tuple
  import tensorflow
  from tensorflow_model_analysis.addons.fairness.notebook import visualization
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.view import view_types
label_desc: Use image node_id 3 for calling a global function with example usage: convert_slicing_metrics_to_ui_input(slicing_metrics, slicing_column, slicing_spec, output_name, multi_class_key) and returns: data