class_docstr: Convenience class for analyzers that revert the model's structure.
  
  This class contains many helper functions around the graph
  reverse function :func:`innvestigate.backend.graph.reverse_model`.
  
  The deriving classes should specify how the graph should be reverted
  by implementing the following functions:
  
  * :func:`_reverse_mapping(layer)` given a layer this function
    returns a reverse mapping for the layer as specified in
    :func:`innvestigate.backend.graph.reverse_model` or None.
  
    This function can be implemented, but it is encouraged to
    implement a default mapping and add additional changes with
    the function :func:`_add_conditional_reverse_mapping` (see below).
  
    The default behavior is finding a conditional mapping (see below),
    if none is found, :func:`_default_reverse_mapping` is applied.
  * :func:`_default_reverse_mapping` defines the default
    reverse mapping.
  * :func:`_head_mapping` defines how the outputs of the model
    should be instantiated before the are passed to the reversed
    network.
  
  Furthermore other parameters of the function
  :func:`innvestigate.backend.graph.reverse_model` can
  be changed by setting the according parameters of the
  init function:
  
  :param reverse_verbose: Print information on the reverse process.
  :param reverse_clip_values: Clip the values that are passed along
    the reverted network. Expects tuple (min, max).
  :param reverse_project_bottleneck_layers: Project the value range
    of bottleneck tensors in the reverse network into another range.
  :param reverse_check_min_max_values: Print the min/max values
    observed in each tensor along the reverse network whenever
    :func:`analyze` is called.
  :param reverse_check_finite: Check if values passed along the
    reverse network are finite.
  :param reverse_keep_tensors: Keeps the tensors created in the
    backward pass and stores them in the attribute
    :attr:`_reversed_tensors`.
  :param reverse_reapply_on_copied_layers: See
    :func:`innvestigate.backend.graph.reverse_model`.
docstr: This function should return a reverse mapping for the passed layer.
  
  If this function returns None, :func:`_default_reverse_mapping`
  is applied.
  
  :param condition: Condition when this mapping should be applied.
    Form: f(layer) -> bool
  :param mapping: The mapping can be of the following forms:
    * A function of form (A) f(Xs, Ys, reversed_Ys, reverse_state)
      that maps reversed_Ys to reversed_Xs (which should contain
      tensors of the same shape and type).
    * A function of form f(B) f(layer, reverse_state) that returns
      a function of form (A).
    * A :class:`ReverseMappingBase` subclass.
  :param priority: The higher the earlier the condition gets
    evaluated.
  :param name: An identifying name.
docstr_tok: ["This","function","should","return","a","reverse","mapping","for","the","passed","layer",".","If","this","function","returns","None",",",":","func",":","`","_default_reverse_mapping","`","is","applied",".",":","param","condition",":","Condition","when","this","mapping","should","be","applied",".","Form",":","f","(","layer",")","-",">","bool",":","param","mapping",":","The","mapping","can","be","of","the","following","forms",":","*","A","function","of","form","(","A",")","f","(","Xs",",","Ys",",","reversed_Ys",",","reverse_state",")","that","maps","reversed_Ys","to","reversed_Xs","(","which","should","contain","tensors","of","the","same","shape","and","type",")",".","*","A","function","of","form","f","(","B",")","f","(","layer",",","reverse_state",")","that","returns","a","function","of","form","(","A",")",".","*","A",":","class",":","`","ReverseMappingBase","`","subclass",".",":","param","priority",":","The","higher","the","earlier","the","condition","gets","evaluated",".",":","param","name",":","An","identifying","name","."]
code: def _add_conditional_reverse_mapping(
      self,
      condition: Callable[[Layer], bool],
      mapping: Callable,  # TODO: specify type of Callable
      priority: int = -1,
      name: str | None = None,
  ):
      """
      This function should return a reverse mapping for the passed layer.
  
      If this function returns None, :func:`_default_reverse_mapping`
      is applied.
  
      :param condition: Condition when this mapping should be applied.
        Form: f(layer) -> bool
      :param mapping: The mapping can be of the following forms:
        * A function of form (A) f(Xs, Ys, reversed_Ys, reverse_state)
          that maps reversed_Ys to reversed_Xs (which should contain
          tensors of the same shape and type).
        * A function of form f(B) f(layer, reverse_state) that returns
          a function of form (A).
        * A :class:`ReverseMappingBase` subclass.
      :param priority: The higher the earlier the condition gets
        evaluated.
      :param name: An identifying name.
      """
      if self._reverse_mapping_applied is True:
          raise Exception(
              "Cannot add conditional mapping "
              "after first application."
          )
  
      # Add key `priority` to dict _conditional_reverse_mappings
      # if it doesn't exist yet.
      if priority not in self._conditional_reverse_mappings:
          self._conditional_reverse_mappings[priority] = []
  
      # Add Conditional Reveserse mapping at given priority
      tmp: CondReverseMapping = {
          "condition": condition,
          "mapping": mapping,
          "name": name,
      }
      self._conditional_reverse_mappings[priority].append(tmp)
  
imports: from __future__ import annotations
  from typing import Callable
  import numpy
  import tensorflow.keras.backend
  import innvestigate.backend
  import innvestigate.backend.graph
  import innvestigate.layers
  from innvestigate.analyzer.network_base import AnalyzerNetworkBase
  from innvestigate.backend.types import CondReverseMapping, Layer, Model, OptionalList, ReverseTensorDict, Tensor
label_desc: Use image node_id 4 for calling the ReverseAnalyzerBase obj's underlying member method code with example usage: obj._add_conditional_reverse_mapping(condition, mapping, priority, name) without return types