class_docstr: A stripped-down handler similar to CodeHandler but that does
  some appropriate monkeypatching.
class_docstr_tok: ["A","stripped-down","handler","similar","to","CodeHandler","but","that","does","some","appropriate","monkeypatching","."]
code: def modify_document(self, doc: Document) -> None:
      if self.failed:
          return
  
      module = self._runner.new_module()
  
      doc.modules.add(module)
  
      orig_curdoc = curdoc()
      set_curdoc(doc)
  
      old_io, old_doc = self._monkeypatch()
  
      try:
          self._runner.run(module, lambda: None)
      finally:
          self._unmonkeypatch(old_io, old_doc)
          set_curdoc(orig_curdoc)
  
file_path: bokeh/src/bokeh/sphinxext/example_handler.py
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING
  from bokeh.application.handlers.code_runner import CodeRunner
  from bokeh.application.handlers.handler import Handler
  from bokeh.core.types import PathLike
  from bokeh.io.doc import curdoc, set_curdoc
label_desc: Use image node_id 2 for calling the ExampleHandler obj's underlying member method code with example usage: obj.modify_document(doc) without return types