code: def find_all_slices(
      results: List[Tuple[slicer.SliceKeyType, Dict[str, Any]]],
      slicing_spec: slicer.SingleSliceSpec,
  ) -> List[Dict[str, Union[Dict[str, Any], str]]]:
      """Util function that extracts slicing metrics for the named column.
  
      Args:
        results: A list of records. Each record is a tuple of (slice_name,
          {metric_name, metric_value}).
        slicing_spec: The spec to slice on.
  
      Returns:
        A list of {slice, metrics}
      """
      data = []
      for slice_key, metric_value in results:
          if slicing_spec.is_slice_applicable(slice_key):
              data.append(
                  {
                      "slice": slicer.stringify_slice_key(slice_key),
                      "metrics": metric_value,
                  }
              )
  
      return data
  
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 2 for calling a global function with example usage: find_all_slices(results, slicing_spec) and returns: data