code: def simple_extract_stack(
      f=None,
      limit: Optional[int] = None,
      skips: Optional[Sequence[str]] = None,
  ) -> list[tuple[Optional[str], int, str, Optional[str]]]:
      """This is traceback.extract_stack from python 2.7 with this change:
  
      - Comment the update of the cache.
      - Skip internal stack trace level.
  
      The update of the cache call os.stat to verify is the cache is up
      to date.  This take too much time on cluster.
  
      limit - The number of stack level we want to return. If None, mean
      all what we can.
  
      skips - partial path of stack level we don't want to keep and count.
          When we find one level that isn't skipped, we stop skipping.
  
      """
      if skips is None:
          skips = []
  
      if f is None:
          f = sys._getframe().f_back
  
      if limit is None:
          if hasattr(sys, "tracebacklimit"):
              limit = sys.tracebacklimit
      trace: list[tuple[Optional[str], int, str, Optional[str]]] = []
      n = 0
      while f is not None and (limit is None or n < limit):
          lineno = f.f_lineno
          co = f.f_code
          filename = co.co_filename
          name = co.co_name
          #        linecache.checkcache(filename)
          line: Optional[str] = linecache.getline(
              filename, lineno, f.f_globals
          )
          if line:
              line = line.strip()
          else:
              line = None
          f = f.f_back
  
          # Just skip inner level
          if len(trace) == 0:
              rm = False
              for p in skips:
                  # The 'tests' exception was added; otherwise, we'd lose the
                  # stack trace during in our test cases. We're not sure this is
                  # the right way to do it, though.
                  if p in filename and "tests" not in filename:
                      rm = True
                      break
              if rm:
                  continue
          trace.append((filename, lineno, name, line))
          n = n + 1
      trace.reverse()
      return trace
  
imports: import linecache
  import sys
  import traceback
  from abc import ABCMeta
  from collections.abc import Sequence
  from io import StringIO
  from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union
label_desc: Use image node_id 1 for calling a global function with example usage: simple_extract_stack(f, limit, skips) and returns: trace