code: def layer_uses_training_bool(layer):
      """Returns whether this layer or any of its children uses the training arg."""
      if (
          layer._expects_training_arg
      ):  # pylint: disable=protected-access
          return True
      visited = {layer}
      to_visit = list_all_layers(layer)
      while to_visit:
          layer = to_visit.pop()
          if layer in visited:
              continue
          if getattr(layer, "_expects_training_arg", True):
              return True
          visited.add(layer)
          to_visit.extend(list_all_layers(layer))
      return False
  
imports: import itertools
  import threading
  import types
  from tensorflow.python.eager import context
  from tensorflow.python.keras import backend
  from tensorflow.python.keras.engine import base_layer_utils
  from tensorflow.python.keras.utils import control_flow_util
  from tensorflow.python.keras.utils import tf_contextlib
  from tensorflow.python.keras.utils import tf_inspect
  from tensorflow.python.keras.utils.generic_utils import LazyLoader
  from tensorflow.python.util import tf_decorator
label_desc: Use image node_id 2 for calling a global function with example usage: layer_uses_training_bool(layer) and returns: False, True, True