class_docstr: Perform a conditional execution. The return types must be identical
  between the true and false branches.
  
  Parameters
  ----------
  pred: tensor<[], bool> (Required)
      * 0-D tensor (scalar) predicate to switch between true and false branches.
  
  _true_fn: function (Required)
      * A Python function that executes if ``pred`` evaluates to ``True``.
      * It must take zero input (i.e, no input), and return one or more values whose type becomes
        the operation's return type.
  
  _false_fn: function (Required)
      * A Python function that executes if ``pred`` evaluates to ``False``.
      * It must take zero input (i.e. no input), and have return types that match those of the
        ``if`` branch.
  
  _existing_blocks: list[Block] (Optional)
      * Python list of ``Block``.
      * For internal use only. When converting a milproto, we already got existing blocks,
        and the ``build_nested_blocks`` function can use them directly.
      * When ``_existing_blocks`` is set, ``_true_fn`` and ``_false_fn`` must be dummy functions which returns ``None``.
  
  Returns
  -------
  tuple
      * Python tuple of ``Variables`` from one of the branches.
class_docstr_tok: ["Perform","a","conditional","execution",".","The","return","types","must","be","identical","between","the","true","and","false","branches",".","Parameters","--","--","--","--","--","pred",":","tensor","<","[","]",",","bool",">","(","Required",")","*","0-D","tensor","(","scalar",")","predicate","to","switch","between","true","and","false","branches",".","_true_fn",":","function","(","Required",")","*","A","Python","function","that","executes","if","``","pred","``","evaluates","to","``","True","``",".","*","It","must","take","zero","input","(","i.e",",","no","input",")",",","and","return","one","or","more","values","whose","type","becomes","the","operation","'s","return","type",".","_false_fn",":","function","(","Required",")","*","A","Python","function","that","executes","if","``","pred","``","evaluates","to","``","False","``",".","*","It","must","take","zero","input","(","i.e",".","no","input",")",",","and","have","return","types","that","match","those","of","the","``","if","``","branch",".","_existing_blocks",":","list","[","Block","]","(","Optional",")","*","Python","list","of","``","Block","``",".","*","For","internal","use","only",".","When","converting","a","milproto",",","we","already","got","existing","blocks",",","and","the","``","build_nested_blocks","``","function","can","use","them","directly",".","*","When","``","_existing_blocks","``","is","set",",","``","_true_fn","``","and","``","_false_fn","``","must","be","dummy","functions","which","returns","``","None","``",".","Returns","--","--","--","-","tuple","*","Python","tuple","of","``","Variables","``","from","one","of","the","branches","."]
code: def build_nested_blocks(self):
      # If the front end is milproto, we already have the well constructed cond/body block.
      # For this case, we set self.blocks directly.
      # We also check that _cond and _body are both dummy functions (return None).
      if (
          self._existing_blocks is not None
          and self._existing_blocks.val is not None
      ):
          assert self._true_fn.val([]) is None
          assert self._false_fn.val([]) is None
          self.blocks = self._existing_blocks.val
          return
  
      # Cond block
      true_block_name = self.name + "_true"
      with Block(name=true_block_name, outer_op=self) as true_block:
          true_func = self._true_fn.val
          true_ret_vars = true_func()
          if isinstance(true_ret_vars, tuple):
              true_ret_vars = list(true_ret_vars)
          if not isinstance(true_ret_vars, list):
              true_ret_vars = [true_ret_vars]
          true_block.set_outputs(true_ret_vars)
          self.blocks.append(true_block)
  
      false_block_name = self.name + "_false"
      with Block(name=false_block_name, outer_op=self) as false_block:
          false_func = self._false_fn.val
          false_ret_vars = false_func()
          if isinstance(false_ret_vars, tuple):
              false_ret_vars = list(false_ret_vars)
          if not isinstance(false_ret_vars, list):
              false_ret_vars = [false_ret_vars]
          false_block.set_outputs(false_ret_vars)
          self.blocks.append(false_block)
  
imports: import copy
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil.mil import Block, get_existing_symbol, get_new_symbol, types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, InternalInputType, ListInputType, PyFunctionInputType, TensorInputType, TupleInputType
  from coremltools.converters.mil.mil.operation import NONE, SYMBOL, VALUE, Operation, mil_list, precondition
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs._utils import infer_type_with_broadcast, promoted_primitive_type
  from coremltools.converters.mil.mil.types import is_compatible_type
  from coremltools.converters.mil.mil.types.type_list import list
  from coremltools.converters.mil.mil.types.type_mapping import builtin_to_string, is_subtype, numpy_type_to_builtin_type, numpy_val_to_builtin_val
label_desc: Use image node_id 1 for calling the cond obj's underlying member method code with example usage: obj.build_nested_blocks() without return types