code: def _evaluate_source(source: str, filename: str, env):
      source = _replace_google_api_key(source, env)
  
      c = ExampleHandler(source=source, filename=filename)
      d = Document()
  
      # We may need to instantiate deprecated objects as part of documenting them
      # in the reference guide. Suppress warnings here to keep the build clean
      with warnings.catch_warnings():
          if "reference" in env.docname:
              warnings.filterwarnings(
                  "ignore", category=BokehDeprecationWarning
              )
          c.modify_document(d)
  
      if c.error:
          raise RuntimeError(
              f"bokeh-plot:: error:\n\n{c.error_detail}\n\nevaluating source:\n\n{source}"
          )
  
      if len(d.roots) != 1:
          raise RuntimeError(
              f"bokeh-plot:: directive expects a single Document root, got {len(d.roots)}"
          )
  
      return d.roots[0], c.doc.strip() if c.doc else None
  
imports: from __future__ import annotations
  from sphinx.util import logging
  import re
  import warnings
  from os import getenv
  from os.path import basename, dirname, join
  from uuid import uuid4
  from docutils import nodes
  from docutils.parsers.rst.directives import choice, flag
  from sphinx.errors import SphinxError
  from sphinx.util import copyfile, ensuredir
  from sphinx.util.display import status_iterator
  from sphinx.util.nodes import set_source_info
  from bokeh.document import Document
  from bokeh.embed import autoload_static
  from bokeh.model import Model
  from bokeh.util.warnings import BokehDeprecationWarning
  from .None import PARALLEL_SAFE
  from .bokeh_directive import BokehDirective
  from .example_handler import ExampleHandler
  from .util import _REPO_TOP, get_sphinx_resources
label_desc: Use image node_id 6 for calling a global function with example usage: _evaluate_source(source, filename, env) and returns: d,  unknown