code: def show_trame(
      plotter,
      mode=None,
      name=None,
      server_proxy_enabled=None,
      server_proxy_prefix=None,
      jupyter_extension_enabled=None,
      collapse_menu=False,
      add_menu=True,
      add_menu_items=None,
      default_server_rendering=True,
      handler=None,
      **kwargs,
  ):
      """Run and display the trame application in jupyter's event loop.
  
      Parameters
      ----------
      plotter : pyvista.Plotter
          The PyVista plotter to show.
  
      mode : str, optional
          The UI view mode. This can be set on the global theme. Options are:
  
          * ``'trame'``: Uses a view that can switch between client and server
            rendering modes.
          * ``'server'``: Uses a view that is purely server rendering.
          * ``'client'``: Uses a view that is purely client rendering (generally
            safe without a virtual frame buffer)
          * ``'html'``: Exports the scene for client rendering that can be
            embedded in a webpage.
  
      name : str, optional
          The name of the trame server on which the UI is defined.
  
      server_proxy_enabled : bool, default: False
          Build a relative URL for use with ``jupyter-server-proxy``.
  
      server_proxy_prefix : str, optional
          URL prefix when using ``server_proxy_enabled``. This can be set
          globally in the theme. To ignore, pass ``False``. For use with
          ``jupyter-server-proxy``, often set to ``proxy/``.
  
      jupyter_extension_enabled : bool, default: False
          Build a relative URL for use with ``trame-jupyter-extension``.
  
      collapse_menu : bool, default: False
          Collapse the UI menu (camera controls, etc.) on start.
  
      add_menu : bool, default: True
          Add a UI controls VCard to the VContainer.
  
      add_menu_items : callable, default: None
          Append more UI controls to the VCard menu. Should be a function similar to
          Viewer.ui_controls().
  
      default_server_rendering : bool, default: True
          Whether to use server-side or client-side rendering on-start when
          using the ``'trame'`` mode.
  
      handler : callable, optional
          Pass a callable that accptes the viewer instance, the string URL,
          and ``**kwargs`` to create custom HTML representations of the output.
  
          .. code:: python
  
              import pyvista as pv
              from IPython.display import IFrame
  
              mesh = pyvista.Wavelet()
  
  
              def handler(viewer, src, **kwargs):
                  return IFrame(src, '75%', '500px')
  
  
              p = pyvista.Plotter(notebook=True)
              _ = p.add_mesh(mesh)
              iframe = p.show(
                  jupyter_backend='trame',
                  jupyter_kwargs=dict(handler=handler),
                  return_viewer=True,
              )
              iframe
  
      **kwargs : dict, optional
          Mostly ignored, though ``protocol`` and ``host`` can be use to
          override the iframe src url and ``height`` and ``width`` can be
          used to override the iframe style. Remaining kwargs are passed to
          ``ipywidgets.widgets.HTML``.
  
      Returns
      -------
      ipywidgets.widgets.HTML or handler result
          Returns a HTML IFrame widget or the result of the passed handler.
  
      """
      if plotter.render_window is None:
          raise RuntimeError(CLOSED_PLOTTER_ERROR)
  
      if plotter._window_size_unset:
          dw, dh = "99%", "600px"
      else:
          dw, dh = plotter.window_size
          dw = f"{dw}px"
          dh = f"{dh}px"
      kwargs.setdefault("width", dw)
      kwargs.setdefault("height", dh)
  
      if mode == "html":
          return EmbeddableWidget(plotter, **kwargs)
  
      if jupyter_extension_enabled is None:
          jupyter_extension_enabled = (
              pyvista.global_theme.trame.jupyter_extension_enabled
          )
  
      if name is None:
          server = get_server(
              name=pyvista.global_theme.trame.jupyter_server_name
          )
      else:
          server = get_server(name=name)
      if name is None and not server.running:
          wslink_backend = "aiohttp"
          if jupyter_extension_enabled:  # pragma: no cover
              wslink_backend = "jupyter"
  
          elegantly_launch(server, wslink_backend=wslink_backend)
          if not server.running:  # pragma: no cover
              raise TrameJupyterServerDownError
      elif not server.running:
          raise TrameServerDownError(name)
  
      # Initialize app
      viewer = initialize(
          server,
          plotter,
          mode=mode,
          default_server_rendering=default_server_rendering,
          collapse_menu=collapse_menu,
          add_menu=add_menu,
          add_menu_items=add_menu_items,
      )
  
      if jupyter_extension_enabled:  # pragma: no cover
          from trame_client.ui.core import (
              iframe_url_builder_jupyter_extension,
          )
  
          iframe_attrs = iframe_url_builder_jupyter_extension(
              viewer.layout
          )
          src = iframe_attrs["src"]
      else:
          # TODO: The build_url function could possibly be replaced by
          # trame's upstream url builders in trame_client.ui.core
          iframe_attrs = {}
          src = build_url(
              server,
              ui=plotter._id_name,
              server_proxy_enabled=server_proxy_enabled,
              server_proxy_prefix=server_proxy_prefix,
              host=kwargs.get("host", "localhost"),
              protocol=kwargs.get("protocol", "http"),
          )
  
      if callable(handler):
          return handler(
              viewer, src, iframe_attrs=iframe_attrs, **kwargs
          )
      return Widget(viewer, src, iframe_attrs=iframe_attrs, **kwargs)
  
imports: import asyncio
  import logging
  import os
  import warnings
  from trame.widgets import html, vtk, vuetify, vuetify3
  import pyvista
  from pyvista.trame.ui import UI_TITLE, get_viewer
  from pyvista.trame.views import CLOSED_PLOTTER_ERROR, get_server
label_desc: Use image node_id 4 for calling a global function with example usage: show_trame(plotter, mode, name, server_proxy_enabled, server_proxy_prefix, jupyter_extension_enabled, collapse_menu, add_menu, add_menu_items, default_server_rendering, handler) and returns: Widget, EmbeddableWidget, handler