code: def cond_v2(pred, true_fn, false_fn, name="cond"):
      """Like tf.cond, except emits a single If op."""
      if isinstance(pred, bool):
          raise TypeError("pred must not be a Python bool", pred)
  
      if not name:
          name = "cond"
  
      with ops.name_scope(name) as scope:
          true_name = util.unique_fn_name(scope, "true")
          false_name = util.unique_fn_name(scope, "false")
  
          # Automatic control dependencies are added in defuns, but not in v1
          # graphs. Propagate that behavior here.
          add_control_dependencies = (
              ops.get_default_graph()._add_control_dependencies
          )
          pred = ops.convert_to_tensor(pred)
          if tensor_util.is_tf_type(pred) and (
              pred.shape.dims is None or pred.shape.dims
          ):
              pred = array_ops.squeeze_v2(pred)
  
          true_graph = func_graph_module.func_graph_from_py_func(
              true_name,
              true_fn,
              [],
              {},
              func_graph=util.CondBranchFuncGraph(
                  true_name,
                  collections=ops.get_default_graph()._collections,
              ),  # pylint: disable=protected-access
              add_control_dependencies=add_control_dependencies,
              op_return_value=pred,
          )
          false_graph = func_graph_module.func_graph_from_py_func(
              false_name,
              false_fn,
              [],
              {},
              func_graph=util.CondBranchFuncGraph(
                  false_name,
                  collections=ops.get_default_graph()._collections,
              ),  # pylint: disable=protected-access
              add_control_dependencies=add_control_dependencies,
              op_return_value=pred,
          )
  
          verify_captures(_COND, [true_graph, false_graph])
          return _build_cond(
              pred,
              true_graph,
              false_graph,
              true_graph.external_captures,
              false_graph.external_captures,
              building_gradient=False,
              name=scope,
          )
  
imports: import collections
  from tensorflow.core.framework import types_pb2
  from tensorflow.python.eager import backprop_util
  from tensorflow.python.framework import auto_control_deps
  from tensorflow.python.framework import auto_control_deps_utils
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import none_tensor
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_util
  from tensorflow.python.ops import control_flow_util_v2
  from tensorflow.python.ops import default_gradient
  from tensorflow.python.ops import gen_functional_ops
  from tensorflow.python.ops import gen_optional_ops
  from tensorflow.python.ops import gradients_util
  from tensorflow.python.ops import handle_data_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling a global function with example usage: cond_v2(pred, true_fn, false_fn, name) and returns: _build_cond