code: def _get_metric_value(
      nested_dict: Mapping[Text, Mapping[Text, Any]], metric_name: Text
  ) -> float:
      """Returns the value of the named metric from a slice's metrics.
  
      Args:
        nested_dict: Dictionary of metrics from slice.
        metric_name: Value to return from the metric slice.
  
      Returns:
        Percentage value of the baseline slice name requested.
  
      Raises:
        KeyError: If the metric name isn't found in the metrics dictionary or if the
          input metrics dictionary is empty.
        TypeError: If an unsupported value type is found within dictionary slice.
          passed.
      """
      for value in nested_dict.values():
          if metric_name in value[""]:
              typed_value = value[""][metric_name]
              if "doubleValue" in typed_value:
                  return typed_value["doubleValue"]
              if "boundedValue" in typed_value:
                  return typed_value["boundedValue"]["value"]
              raise TypeError(
                  "Unsupported value type: %s" % typed_value
              )
          else:
              raise KeyError(
                  "Key %s not found in %s"
                  % (metric_name, list(value[""].keys()))
              )
      raise KeyError(
          "Unable to return a metric value because the dictionary passed is empty."
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Any, Dict, Mapping, Text
  import tensorflow_model_analysis
label_desc: Use image node_id 2 for calling a global function with example usage: _get_metric_value(nested_dict, metric_name) and returns: typed_value, typed_value