code: def if_stmt(
      self,
      cond,
      body,
      orelse,
      get_state,
      set_state,
      symbol_names,
      nouts,
  ):
      # Initial checkpoint before if
      init_state = get_state()
      with _cond_manager(cond) as split_predicate:
          # Set the state for the body inputs, execute the body and collect the outputs.
          # Verify if all outputs are initialized within the branch, split the outputs if they
          # were just passed through, so they can be merged with the other branch.
          with _cond_true():
              body()
  
              body_state = get_state()
  
              _verify_branch_outputs(body_state, symbol_names, "if")
              body_outputs = body_state[:nouts]
              body_outputs = apply_conditional_split_to_branch_outputs(
                  body_outputs
              )
  
          # Do the same for else block.
          set_state(init_state)
          with _cond_false():
              orelse()
  
              orelse_state = get_state()
  
              _verify_branch_outputs(orelse_state, symbol_names, "else")
              orelse_outputs = orelse_state[:nouts]
              orelse_outputs = (
                  apply_conditional_split_to_branch_outputs(
                      orelse_outputs
                  )
              )
  
          # Build the state that is the combination of both branches. Only the actual outputs
          # should be affected by the if/else blocks, the rest can be reused from-before split.
          output_values = []
          # We execute the merge _after_ both branches, and pretend for a moment, that it
          # can see those values produced in child scopes.
          with _cond_merge(split_predicate):
              err_msg = (
                  "Divergent data found in different branches of `if/else` control flow"
                  " statement. Variables in all code paths are merged into common output"
                  " batches. The values assigned to a given variable need to have the same"
                  " nesting structure in every code path (both `if` branches).\n"
                  "For example, if we define a variable as a tuple in one branch, it must"
                  " be defined as a tuple of the same length in the other branch - the"
                  " contents of the tuples may be different. If we define a variable as"
                  " a dictionary, the other branch must define it as a dictionary with the"
                  " same set of keys, the values may be different.\n"
              )
  
              try:
                  tree.assert_same_structure(
                      body_outputs, orelse_outputs, check_types=True
                  )
              except ValueError as e:
                  # Suppress the original exception, add DALI explanation at the beginning,
                  # raise the full error message.
                  raise ValueError(err_msg + str(e)) from None
              except TypeError as e:
                  raise TypeError(err_msg + str(e)) from None
  
              def merge_branches(new_body_val, new_orelse_val):
                  logging.log(
                      9,
                      (
                          f"{this_condition_stack()._indent()}[IF] Inserting merge"
                          f" at {this_condition_stack().stack_depth() -1}:"
                          f" merge({new_body_val}, {new_orelse_val}, predicate="
                          f"{split_predicate}."
                      ),
                  )
                  return fn._conditional.merge(
                      new_body_val,
                      new_orelse_val,
                      predicate=split_predicate,
                  )
  
              output_values = tree.map_structure(
                  merge_branches, body_outputs, orelse_outputs
              )
  
      # Register the new nodes outside of the conditional scope, they will be used in subsequent
      # calls.
      this_condition_stack().register_data_nodes(output_values, False)
      # No point in propagating the split/merged values that won't be read later.
      output_values += init_state[nouts:]
      set_state(output_values)
  
imports: from nvidia.dali import _autograph
  from nvidia.dali.data_node import DataNode
  from nvidia.dali import fn
  from nvidia.dali._autograph.utils import ag_logging
  from nvidia.dali._autograph.operators import variables
  from contextlib import contextmanager
  from enum import Enum
  import tree
label_desc: Use image node_id 4 for calling the DaliOperatorOverload obj's underlying member method code with example usage: obj.if_stmt(cond, body, orelse, get_state, set_state, symbol_names, nouts) and returns: fn