code: def for_stmt(
      iter_, extra_test, body, get_state, set_state, symbol_names, opts
  ):
      """Functional form of a for statement.
  
      The loop operates on a state, which includes all symbols that are
      variant across loop iterations, excluding the variables local to the loop.
  
      For example, given the loop below that calculates the geometric and
      arithmetic means or some numbers:
  
      ```
        geo_mean = 1
        arith_mean = 0
        for i in range(n):
          a = numbers[i]
          geo_mean *= a
          arith_mean += a
      ```
  
      The state is represented by the variables geo_mean and arith_mean. The
      `extra_test`, `body`, `get_state` and `set_state` functions must bind to the
      original `geo_mean` and `arith_mean` symbols, using `nonlocal`.
  
      The inputs and outputs of the callables representing the loop blocks are not
      explicit - instead, these functions must use nonlocal/global for side effects.
      The inputs and outputs are instead controlled by the set_state/get_state
      functions.
  
      Args:
        iter_: The entity being iterated over.
        extra_test: Callable with boolean return type. An additional loop condition.
        body: Callable representing the actual loop body.
        get_state: Additional callable which can capture additional state (such as
          the values of composite symbols). This is only useful when staging the
          loop.
        set_state: Additional callable which save values captured by get_state back
          into the Python environment. This is only useful when staging the loop.
        symbol_names: Tuple containing names of the loop variables returned by
          get_state.
        opts: Optional dict of extra loop parameters.
      """
      if hooks._DISPATCH.detect_overload_for_stmt(iter_):
          hooks._DISPATCH.for_stmt(
              iter_,
              extra_test,
              body,
              get_state,
              set_state,
              symbol_names,
              opts,
          )
      else:
          _py_for_stmt(iter_, extra_test, body, None, None)
  
imports: from nvidia.dali._autograph.utils import hooks
label_desc: Use image node_id 1 for calling a global function with example usage: for_stmt(iter_, extra_test, body, get_state, set_state, symbol_names, opts) without return types