code: def format_exc(limit=None, chain=True):
      """Like print_exc() but return a string."""
      return "".join(
          format_exception(*sys.exc_info(), limit=limit, chain=chain)
      )
  
imports: import collections.abc
  import itertools
  import linecache
  import sys
  import textwrap
  from contextlib import suppress
label_desc: Use image node_id 13 for calling a global function with example usage: format_exc(limit, chain) and returns: str