code: def get_bottleneck_nodes(
      inputs: list[Tensor],
      outputs: list[Tensor],
      execution_list: list[tuple[Layer, list[Tensor], list[Tensor]]],
  ) -> list[tuple[Layer, tuple[list[Tensor], list[Tensor]]]]:
      """
      Given an execution list this function returns all nodes that
      are a bottleneck in the network, i.e., "all information" must pass
      through this node.
      """
      forward_connections: dict[int, list[Tensor]] = {}
      for l, Xs, Ys in execution_list:
          if isinstance(l, klayers.InputLayer):
              # Special case, do nothing.
              continue
  
          for X in Xs:
              if id(X) in forward_connections:
                  forward_connections[id(X)] += Ys
              else:
                  forward_connections[id(X)] = list(Ys)
  
      open_connections: dict[int, bool] = {}
      for X in inputs:
          for fw_c in forward_connections[id(X)]:
              open_connections[id(fw_c)] = True
  
      ret = []
      for l, Xs, Ys in execution_list:
          if isinstance(l, klayers.InputLayer):
              # Special case, do nothing.
              # Note: if a single input branches
              # this is not detected.
              continue
  
          for Y in Ys:
              assert id(Y) in open_connections
              del open_connections[id(Y)]
  
          if len(open_connections) == 0:
              ret.append((l, (Xs, Ys)))
  
          for Y in Ys:
              if Y not in outputs:
                  for fwc in forward_connections[id(Y)]:
                      open_connections[id(fwc)] = True
  
      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 19 for calling a global function with example usage: get_bottleneck_nodes(inputs, outputs, execution_list) and returns: ret