code: def _find_originating_frame(caller_fn_scope, innermost=True):
      """Locates the frame in which `caller_fn_scope` was defined."""
      ctx_frame = inspect.currentframe()
      result = None
      while ctx_frame is not None:
          # Note it should not be normally possible to get false positives this way
          # because the function scope object is not accessible to user code (barring
          # call stack introspection).
          if (
              ctx_frame.f_locals.get(caller_fn_scope.name, None)
              is caller_fn_scope
          ):
              result = ctx_frame
              if innermost:
                  break
          ctx_frame = ctx_frame.f_back
  
      assert result is not None, (
          "the conversion process should ensure the caller_fn_scope is always"
          " found somewhere on the call stack"
      )
  
      return result
  
imports: import inspect
  from nvidia.dali._autograph.utils import hooks
label_desc: Use image node_id 2 for calling a global function with example usage: _find_originating_frame(caller_fn_scope, innermost) and returns: result