code: def __init__(
      self,
      docid: ID | None = None,
      token: str | None = None,
      elementid: ID | None = None,
      roots: list[Model] | dict[Model, ID] | None = None,
      use_for_title: bool | None = None,
  ):
      if (docid is None and token is None) or (
          docid is not None and token is not None
      ):
          raise ValueError("either docid or sessionid must be provided")
  
      if roots is None:
          roots = dict()
      elif isinstance(roots, list):
          roots = {root: make_globally_unique_id() for root in roots}
  
      self.docid = docid
      self.token = token
      self.elementid = elementid
      self.roots = RenderRoots(roots)
      self.use_for_title = use_for_title
  
imports: from __future__ import annotations
  import logging
  import re
  from contextlib import contextmanager
  from typing import TYPE_CHECKING, Any, Iterator, Sequence
  from weakref import WeakKeyDictionary
  from ..core.types import ID
  from ..document.document import Document
  from ..model import Model, collect_models
  from ..settings import settings
  from ..themes.theme import Theme
  from ..util.dataclasses import dataclass, field
  from ..util.serialization import make_globally_unique_css_safe_id, make_globally_unique_id
label_desc: Use image node_id 1 to create a new RenderItem object  with example: obj = RenderItem(docid, token, elementid, roots, use_for_title)