code: def make_fi_ui_payload(
      slicing_metrics=None, multi_slicing_metrics=None
  ) -> Dict[str, Any]:
      """Creates a Python Dict that can be passed into the Fairness Indicators JS UI.
  
      Args:
        slicing_metrics: A dictionary containing data for visualization.
        multi_slicing_metrics: A dictionary that maps eval name to the
          slicing_metrics. Only two eval results will be accepted.
  
      Returns:
        Python Dict that can be passed to JS UI
      """
      if (slicing_metrics and multi_slicing_metrics) or (
          not slicing_metrics and not multi_slicing_metrics
      ):
          raise ValueError(
              'Exactly one of the "slicing_metrics" and "multi_slicing_metrics" '
              "parameters must be set."
          )
  
      if slicing_metrics:
          return {"slicingMetrics": slicing_metrics}
  
      eval_name, eval_name_compare = multi_slicing_metrics.keys()
      slicing_metrics = multi_slicing_metrics[eval_name]
      slicing_metrics_compare = multi_slicing_metrics[eval_name_compare]
      return {
          "slicingMetrics": slicing_metrics,
          "slicingMetricsCompare": slicing_metrics_compare,
          "evalName": eval_name,
          "evalNameCompare": eval_name_compare,
      }
  
imports: from typing import Optional, Dict, Any
  from IPython import display
  from tensorflow_model_analysis.notebook.colab.util import make_trusted_event_handler_js
  from tensorflow_model_analysis.notebook.colab.util import PythonEventHandlersMap
  from tensorflow_model_analysis.notebook.colab.util import to_base64_encoded_json
label_desc: Use image node_id 2 for calling a global function with example usage: make_fi_ui_payload(slicing_metrics, multi_slicing_metrics) and returns: dict, dict