class_docstr: Tracks the current if/else scope with the path that we took. Captures the used and produced
  data nodes, applying the necessary splits based on the scope level where they were produced
  and where they are used.
docstr: Find the closest scope level in the stack where we can access this node as produced
  (or the split of this node closest to us).
docstr_tok: ["Find","the","closest","scope","level","in","the","stack","where","we","can","access","this","node","as","produced","(","or","the","split","of","this","node","closest","to","us",")","."]
code: def _find_closest(self, data_node):
      """Find the closest scope level in the stack where we can access this node as produced
      (or the split of this node closest to us).
      """
      for level in range(self.stack_depth() - 1, -1, -1):
          if self._stack[level].has(data_node):
              return level
  
      raise ValueError(
          f"{data_node} was not produced within this trace."
      )
  
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 6 for calling the _ConditionStack obj's underlying member method code with example usage: obj._find_closest(data_node) and returns: level