code: def disable_ui_events(fig):
      """Temporarily disable generation of UI events. Use as context manager.
  
      Parameters
      ----------
      fig : matplotlib.figure.Figure | Figure3D
          The figure whose UI event generation should be temporarily disabled.
      """
      _disabled_event_channels.add(fig)
      try:
          yield
      finally:
          _disabled_event_channels.remove(fig)
  
imports: import contextlib
  import re
  import weakref
  from dataclasses import dataclass
  from typing import Optional, Union
  from matplotlib.colors import Colormap
  from ..utils import _validate_type, fill_doc, logger, verbose, warn
label_desc: Use image node_id 7 for calling a global function with example usage: disable_ui_events(fig) without return types