code: def pre_output_tensors(
      Xs: Tensor, activation: str = None
  ) -> list[Tensor]:
      """Finds the tensors that were preceeding a potential activation."""
      activation_found = False
  
      Xs = ibackend.to_list(Xs)
      ret = []
      for x in Xs:
          layer, node_index, _tensor_index = x._keras_history
          if ichecks.contains_activation(layer, activation=activation):
              activation_found = True
              if isinstance(layer, klayers.Activation):
                  ret.append(layer.get_input_at(node_index))
              else:
                  layer_wo_act = copy_layer_wo_activation(layer)
                  ret.append(
                      layer_wo_act(layer.get_input_at(node_index))
                  )
  
      if not activation_found:
          if not activation == None:
              raise Exception(f"No output activation found.")
          else:
              raise Exception(f"No {activation} found.")
  
      return ret
  
imports: from __future__ import annotations
  import inspect
  import warnings
  from abc import ABCMeta, abstractmethod
  from typing import Any, Callable
  import numpy
  import tensorflow.keras.backend
  import tensorflow.keras.layers
  import tensorflow.keras.models
  import innvestigate.backend
  import innvestigate.backend.checks
  import innvestigate.layers
  from innvestigate.backend.types import Layer, LayerCheck, Model, NodeDict, OptionalList, ReverseTensorDict, Tensor
label_desc: Use image node_id 9 for calling a global function with example usage: pre_output_tensors(Xs, activation) and returns: ret