class_docstr: Manage and provide access to all of the models that belong to a Bokeh
  Document.
  
  The set of "all models" means specifically all the models reachable from
  references form a Document's roots.
class_docstr_tok: ["Manage","and","provide","access","to","all","of","the","models","that","belong","to","a","Bokeh","Document",".","The","set","of","``","all","models","''","means","specifically","all","the","models","reachable","from","references","form","a","Document","'s","roots","."]
code: def _on_event(
      self,
      event: str | type[Event],
      *callbacks: EventCallback | JSEventCallback,
  ) -> None:
      if not isinstance(event, str) and issubclass(event, Event):
          event = event.event_name
  
      if event not in _CONCRETE_EVENT_CLASSES:
          raise ValueError(f"Unknown event {event}")
  
      if not issubclass(_CONCRETE_EVENT_CLASSES[event], DocumentEvent):
          raise ValueError(
              "Document.on_event may only be used to subscribe "
              "to events of type DocumentEvent. To subscribe "
              "to a ModelEvent use the Model.on_event method."
          )
  
      for callback in callbacks:
          if isinstance(callback, JSEventCallback):
              self._js_event_callbacks[event].append(callback)
          else:
              _check_callback(
                  callback, ("event",), what="Event callback"
              )
              self._event_callbacks[event].append(callback)
  
imports: from __future__ import annotations
  import logging
  import weakref
  from collections import defaultdict
  from functools import wraps
  from typing import TYPE_CHECKING, Any, Callable
  from ..core.enums import HoldPolicy, HoldPolicyType
  from ..events import _CONCRETE_EVENT_CLASSES, DocumentEvent, Event, ModelEvent
  from ..model import Model
  from ..models.callbacks import Callback
  from ..util.callback_manager import _check_callback
  from .events import DocumentPatchedEvent, ModelChangedEvent, RootAddedEvent, RootRemovedEvent, SessionCallbackAdded, SessionCallbackRemoved, TitleChangedEvent
  from .locking import UnlockedDocumentProxy
label_desc: Use image node_id 15 for calling the DocumentCallbackManager obj's underlying member method code with example usage: obj._on_event(event) without return types