code: def should_use_v2():
      """Determine if v1 or v2 version should be used."""
      if context.executing_eagerly():
          return True
      elif ops.executing_eagerly_outside_functions():
          # Check for a v1 `wrap_function` FuncGraph.
          # Code inside a `wrap_function` is treated like v1 code.
          graph = ops.get_default_graph()
          if getattr(graph, "name", False) and graph.name.startswith(
              "wrapped_function"
          ):
              return False
          return True
      else:
          return False
  
file_path: tensorflow/tensorflow/python/keras/utils/version_utils.py
imports: from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.keras.utils.generic_utils import LazyLoader
label_desc: Use image node_id 1 for calling a global function with example usage: should_use_v2() and returns: True, True, False, False