code: def contains_activation(layer: Layer, activation: str = None) -> bool:
      """Check whether the layer contains an activation function of type `activation`.
      If `activation` is None, only check if layer can contain an activation.
  
      :param layer: Keras layer to check
      :type layer: Layer
      :param activation: Keras name of activation function, defaults to None
      :type activation: str, optional
      :return: If `activation` is None, check if layer contains any activation function.
          Otherwise check for specific activation function of type `activation`.
      :rtype: bool
      """
  
      if activation is None:
          return contains_any_activation(layer)
      a = activation.lower()
  
      # Check for activations in layer
      if hasattr(layer, "activation"):
          return bool(layer.activation == keras.activations.get(a))
  
      # Check for layers that are activations
      if a == "softmax":
          return isinstance(layer, (klayers.Softmax))
      if a == "relu":
          return isinstance(layer, (klayers.ReLU))
      if a == "elu":
          return isinstance(layer, (klayers.ELU))
      if a == "prelu":
          return isinstance(layer, (klayers.PReLU))
      if a == "leakyrelu":
          return isinstance(layer, (klayers.LeakyReLU))
      if a == "thresholdedrelu":
          return isinstance(layer, (klayers.ThresholdedReLU))
      return False
  
imports: from __future__ import annotations
  import tensorflow.keras.layers
  from tensorflow import Module, keras
  import innvestigate.backend
  from innvestigate.backend.types import Layer, Model
label_desc: Use image node_id 2 for calling a global function with example usage: contains_activation(layer, activation) and returns: False, contains_any_activation, bool, isinstance, isinstance, isinstance, isinstance, isinstance, isinstance