code: def stackFromFrame(frame, lastFrame=None):
      """Return (text, stack_frame) for the entire stack ending at *frame*
  
      If *lastFrame* is given and present in the stack, then the stack is truncated
      at that frame.
      """
      lines = traceback.format_stack(frame)
      frames = []
      while frame is not None:
          frames.insert(0, frame)
          frame = frame.f_back
      if lastFrame is not None and lastFrame in frames:
          frames = frames[: frames.index(lastFrame) + 1]
  
      return list(zip(lines[: len(frames)], frames))
  
file_path: pyqtgraph/pyqtgraph/console/stackwidget.py
imports: import sys, traceback
  from ..Qt import QtWidgets, QtGui
label_desc: Use image node_id 1 for calling a global function with example usage: stackFromFrame(frame, lastFrame) and returns: list