code: def show_doc(
      obj: Model,
      state: State,
      notebook_handle: CommsHandle | None = None,
  ) -> CommsHandle | None:
      """ """
      if obj not in state.document.roots:
          state.document.add_root(obj)
  
      from ..embed.notebook import notebook_content
  
      comms_target = make_id() if notebook_handle else None
      (script, div, cell_doc) = notebook_content(obj, comms_target)
  
      publish_display_data({HTML_MIME_TYPE: div})
      publish_display_data(
          {JS_MIME_TYPE: script, EXEC_MIME_TYPE: ""},
          metadata={EXEC_MIME_TYPE: {"id": obj.id}},
      )
  
      # Comms handling relies on the fact that the cell_doc returned by
      # notebook copy has models with the same IDs as the original curdoc
      # they were copied from
      if comms_target:
          handle = CommsHandle(get_comms(comms_target), cell_doc)
          state.document.callbacks.on_change_dispatch_to(handle)
          state.last_comms_handle = handle
          return handle
  
      return None
  
imports: from __future__ import annotations
  import logging
  import json
  import os
  import urllib
  from typing import TYPE_CHECKING, Any, Callable, Literal, Protocol, TypedDict, Union, cast, overload
  from uuid import uuid4
  from ..core.types import ID
  from ..util.serialization import make_id
  from ..util.warnings import warn
  from .state import curstate
label_desc: Use image node_id 12 for calling a global function with example usage: show_doc(obj, state, notebook_handle) and returns: None, handle