code: def _get_frame(level):
      """Get the frame at the given stack level."""
      # sys._getframe is much faster than inspect.stack, but isn't guaranteed to
      # exist in all python implementations, so we fall back to inspect.stack()
  
      # We need to add one to level to account for this get_frame call.
      if hasattr(sys, "_getframe"):
          frame = sys._getframe(level + 1)
      else:
          frame = inspect.stack(context=0)[level + 1].frame
      return frame
  
imports: from pathlib import Path
  import sys
  import inspect
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: _get_frame(level) and returns: frame