code: def get_time_series(
      results: view_types.EvalResults,
      slicing_spec: slicer.SingleSliceSpec,
      display_full_path: bool,
  ) -> List[Dict[str, Union[Dict[Union[float, str], Any], str]]]:
      """Util function that extracts time series data for the specified slice.
  
      Args:
        results: A collection of EvalResult whose metrics should be visualized in a
          time series.
        slicing_spec: The spec specifying the slice to show in the time series.
        display_full_path: Whether to display the full path or just the file name.
  
      Returns:
        A list of dictionaries, where each dictionary contains the config and the
        metrics for the specified slice for a single eval run.
  
      Raises:
        ValueError: if the given slice spec matches more than one slice for any eval
        run in results or if the slicing spec matches nothing in all eval runs.
      """
      data = []
      for result in results.get_results():
          matching_slices = find_all_slices(
              result.slicing_metrics, slicing_spec
          )
          slice_count = len(matching_slices)
          if slice_count == 1:
              data.append(
                  {
                      "metrics": matching_slices[0]["metrics"],
                      "config": {
                          "modelIdentifier": _get_identifier(
                              result.model_location, display_full_path
                          ),
                          "dataIdentifier": _get_identifier(
                              result.data_location, display_full_path
                          ),
                      },
                  }
              )
          elif slice_count > 1:
              raise ValueError(
                  "Given slice spec matches more than one slice."
              )
  
      run_count = len(data)
      if not run_count:
          raise ValueError(
              "Given slice spec has no matches in any eval run."
          )
  
      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 3 for calling a global function with example usage: get_time_series(results, slicing_spec, display_full_path) and returns: data