code: def save(
      obj: UIElement | Sequence[UIElement],
      filename: PathLike | None = None,
      resources: ResourcesLike | None = None,
      title: str | None = None,
      template: Template | str | None = None,
      state: State | None = None,
  ) -> str:
      """Save an HTML file with the data for the current document.
  
      Will fall back to the default output state (or an explicitly provided
      :class:`State` object) for ``filename``, ``resources``, or ``title`` if they
      are not provided. If the filename is not given and not provided via output state,
      it is derived from the script name (e.g. ``/foo/myplot.py`` will create
      ``/foo/myplot.html``)
  
      Args:
          obj (UIElement object) : a Layout (Row/Column), Plot or Widget object to display
  
          filename (PathLike, e.g. str, Path, optional) : filename to save document under (default: None)
              If None, use the default state configuration.
  
          resources (Resources or ResourcesMode, optional) : A Resources config to use (default: None)
              If None, use the default state configuration, if there is one.
              otherwise use ``resources.INLINE``.
  
          title (str, optional) : a title for the HTML document (default: None)
              If None, use the default state title value, if there is one.
              Otherwise, use "Bokeh Plot"
  
          template (Template, str, optional) : HTML document template (default: FILE)
              A Jinja2 Template, see bokeh.core.templates.FILE for the required template
              parameters
  
          state (State, optional) :
              A :class:`State` object. If None, then the current default
              implicit state is used. (default: None).
  
      Returns:
          str: the filename where the HTML file is saved.
  
      """
  
      if state is None:
          state = curstate()
  
      theme = state.document.theme
  
      filename, resources, title = _get_save_args(
          state, filename, resources, title
      )
      _save_helper(obj, filename, resources, title, template, theme)
      return abspath(expanduser(filename))
  
imports: from __future__ import annotations
  import logging
  from os.path import abspath, expanduser
  from typing import Sequence
  from jinja2 import Template
  from ..core.templates import FILE
  from ..core.types import PathLike
  from ..models.ui import UIElement
  from ..resources import Resources, ResourcesLike
  from ..settings import settings
  from ..themes import Theme
  from ..util.warnings import warn
  from .state import State, curstate
  from .util import default_filename
label_desc: Use image node_id 1 for calling a global function with example usage: save(obj, filename, resources, title, template, state) and returns: abspath