code: def report_error(err, use_stack=True):
      if error_stack and use_stack:
          error_stack[-1].append(err)
      else:
          global num_errors
          # See Main.py for why dual reporting occurs. Quick fix for now.
          if err.reported:
              return
          err.reported = True
          try:
              line = "%s\n" % err
          except UnicodeEncodeError:
              # Python <= 2.5 does this for non-ASCII Unicode exceptions
              line = (
                  format_error(
                      getattr(
                          err,
                          "message_only",
                          "[unprintable exception message]",
                      ),
                      getattr(err, "position", None),
                  )
                  + "\n"
              )
          if listing_file:
              try:
                  listing_file.write(line)
              except UnicodeEncodeError:
                  listing_file.write(line.encode("ASCII", "replace"))
          if echo_file:
              try:
                  echo_file.write(line)
              except UnicodeEncodeError:
                  echo_file.write(line.encode("ASCII", "replace"))
          num_errors += 1
          if Options.fast_fail:
              raise AbortError("fatal errors")
  
imports: from __future__ import absolute_import
  import sys
  from contextlib import contextmanager
  from ..Utils import open_new_file
  from .None import DebugFlags
  from .None import Options
label_desc: Use image node_id 6 for calling a global function with example usage: report_error(err, use_stack) without return types