code: def _group_metric_by_slice(
      eval_result: tfma.EvalResult,
  ) -> Dict[str, Dict[str, float]]:
      """Returns a dictionary holding metric values for every slice.
  
      Args:
        eval_result: evaluation result.
  
      Returns:
        a slice map that holds a dictionary of metric and value for slices.
      """
      slice_map = {}
      for metric in eval_result.slicing_metrics:
          slice_map[metric[0]] = {
              k: v["doubleValue"] for k, v in metric[1][""][""].items()
          }
      return slice_map
  
imports: import filecmp
  import os
  from typing import Dict, List, Optional
  from absl import logging
  import tensorflow_model_analysis
  from tfx import types
  from tfx.dsl.io import fileio
  from tfx.experimental.pipeline_testing import pipeline_recorder_utils
  from tfx.orchestration import metadata
  from tfx.types import artifact_utils
  from tfx.utils import io_utils
  from ml_metadata.proto import metadata_store_pb2
  from tensorflow_metadata.proto.v0 import anomalies_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: _group_metric_by_slice(eval_result) and returns: slice_map