code: def initialize(
      server,
      plotter,
      mode=None,
      default_server_rendering=True,
      collapse_menu=False,
      **kwargs,
  ):  # numpydoc ignore=PR01,RT01
      """Generate the UI for a given plotter."""
      state = server.state
      state.trame__title = UI_TITLE
  
      viewer = get_viewer(
          plotter,
          server=server,
          suppress_rendering=mode == "client",
      )
  
      with viewer.make_layout(
          server, template_name=plotter._id_name
      ) as layout:
          viewer.layout = layout
          viewer.ui(
              mode=mode,
              default_server_rendering=default_server_rendering,
              collapse_menu=collapse_menu,
              **kwargs,
          )
  
      return viewer
  
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 3 for calling a global function with example usage: initialize(server, plotter, mode, default_server_rendering, collapse_menu) and returns: viewer