code: def format_exception(
      exc, /, value=_sentinel, tb=_sentinel, limit=None, chain=True
  ):
      """Format a stack trace and the exception information.
  
      The arguments have the same meaning as the corresponding arguments
      to print_exception().  The return value is a list of strings, each
      ending in a newline and some containing internal newlines.  When
      these lines are concatenated and printed, exactly the same text is
      printed as does print_exception().
      """
      value, tb = _parse_value_tb(exc, value, tb)
      te = TracebackException(
          type(value), value, tb, limit=limit, compact=True
      )
      return list(te.format(chain=chain))
  
imports: import collections.abc
  import itertools
  import linecache
  import sys
  import textwrap
  from contextlib import suppress
label_desc: Use image node_id 8 for calling a global function with example usage: format_exception(value, tb, limit, chain) and returns: list