code: def _scores_by_class_id(
      class_id: int, scores: np.ndarray
  ) -> np.ndarray:
      """Returns selected class ID or raises ValueError."""
      if class_id < 0 or class_id >= len(scores):
          raise ValueError(
              'class_id "{}" out of range for attribution {}'.format(
                  class_id, scores
              )
          )
      return scores[class_id]
  
imports: import functools
  from typing import Any, Dict, Iterable, List, Optional, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.metrics import example_count
  from tensorflow_model_analysis.metrics import metric_specs
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 5 for calling a global function with example usage: _scores_by_class_id(class_id, scores) and returns: scores