code: def iter_stack(
      frame_or_tb: Union[FrameType, TracebackType]
  ) -> Iterator[Union[FrameType, TracebackType]]:
      current: Union[FrameType, TracebackType, None] = frame_or_tb
      while current:
          yield current
          if is_frame(current):
              current = current.f_back
          else:
              current = current.tb_next
  
imports: import ast
  import itertools
  import types
  from collections import OrderedDict, Counter, defaultdict
  from types import FrameType, TracebackType
  from typing import Iterator, List, Tuple, Iterable, Callable, Union, TypeVar, Mapping
  from asttokens import ASTText
label_desc: Use image node_id 8 for calling a global function with example usage: iter_stack(frame_or_tb) without return types