code: def jupyter_renderer(spec: dict, **metadata):
      """Render chart using the JupyterChart Jupyter Widget"""
      from altair import Chart, JupyterChart
  
      # Configure offline mode
      offline = metadata.get("offline", False)
  
      # mypy doesn't see the enable_offline class method for some reason
      JupyterChart.enable_offline(offline=offline)  # type: ignore[attr-defined]
  
      # propagate embed options
      embed_options = metadata.get("embed_options", None)
  
      # Need to ignore attr-defined mypy rule because mypy doesn't see _repr_mimebundle_
      # conditionally defined in AnyWidget
      return JupyterChart(
          chart=Chart.from_dict(spec), embed_options=embed_options
      )._repr_mimebundle_()
  
file_path: altair/altair/vegalite/v5/display.py
imports: import os
  from typing import Dict
  from ...utils.mimebundle import spec_to_mimebundle
  from ..display import Displayable, default_renderer_base, json_renderer_base, RendererRegistry, HTMLRenderer, DefaultRendererReturnType
  from .schema import SCHEMA_VERSION
  from typing import Final
label_desc: Use image node_id 5 for calling a global function with example usage: jupyter_renderer(spec) and returns: JupyterChart