code: def _close_event(fig):
      """Force calling of the MPL figure close event."""
      from matplotlib import backend_bases
  
      from .utils import logger
  
      try:
          fig.canvas.callbacks.process(
              "close_event",
              backend_bases.CloseEvent(
                  name="close_event", canvas=fig.canvas
              ),
          )
          logger.debug(f"Called {fig!r}.canvas.close_event()")
      except ValueError:  # old mpl with Qt
          logger.debug(f"Calling {fig!r}.canvas.close_event() failed")
          pass
  
imports: import inspect
  import operator
  import os
  import warnings
  from contextlib import contextmanager
  from io import StringIO
  from math import log
  from pprint import pprint
  import numpy
label_desc: Use image node_id 17 for calling a global function with example usage: _close_event(fig) without return types