code: def _get_frame(level: int) -> FrameType | None:
      """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 __future__ import annotations
  import asyncio
  import atexit
  import errno
  import inspect
  import sys
  import threading
  import warnings
  from pathlib import Path
  from types import FrameType
  from typing import Any, Awaitable, Callable, TypeVar, cast
label_desc: Use image node_id 2 for calling a global function with example usage: _get_frame(level) and returns: frame