code: def _get_activation_layer(model, layer):
      # type: (Model, Union[None, int, str, Layer]) -> Layer
      """
      Get an instance of the desired activation layer in ``model``,
      as specified by ``layer``.
      """
      if layer is None:
          # Automatically get the layer if not provided
          activation_layer = _search_layer_backwards(
              model, _is_suitable_activation_layer
          )
          return activation_layer
  
      if isinstance(layer, Layer):
          activation_layer = layer
      # get_layer() performs a bottom-up horizontal graph traversal
      # it can raise ValueError if the layer index / name specified is not found
      elif isinstance(layer, int):
          activation_layer = model.get_layer(index=layer)
      elif isinstance(layer, str):
          activation_layer = model.get_layer(name=layer)
      else:
          raise TypeError(
              "Invalid layer (must be str, int, keras.layers.Layer, or None): %s"
              % layer
          )
  
      if _is_suitable_activation_layer(model, activation_layer):
          # final validation step
          return activation_layer
      else:
          raise ValueError(
              "Can not perform Grad-CAM on the retrieved activation layer"
          )
  
imports: from __future__ import absolute_import
  from typing import Union, Optional, Callable, Tuple, List, TYPE_CHECKING
  import numpy
  import keras
  import keras.backend
  from keras.models import Model
  from keras.layers import Layer
  from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, GlobalMaxPooling2D, GlobalAveragePooling2D
  from keras.preprocessing.image import array_to_img
  from eli5.base import Explanation, TargetExplanation
  from eli5.explain import explain_prediction
  from .gradcam import gradcam, gradcam_backend
label_desc: Use image node_id 10 for calling a global function with example usage: _get_activation_layer(model, layer) and returns: activation_layer, activation_layer