code: def widget_to_html_string(
      widget: Widget,
      title: str = "",
      requirejs: bool = True,
      connected: bool = True,
      full_html: bool = True,
  ) -> str:
      """Transform widget into html string.
  
      Parameters
      ----------
      widget: Widget
          The widget to save as html.
      title: str
          The title of the html file.
      requirejs: bool , default: True
          If to save with all javascript dependencies
      connected : bool, default True
          whether to use CDN or not
      full_html: bool, default True
          whether to return full html page or not
  
      Returns
      -------
      str
      """
      buffer = io.StringIO()
      widget_to_html(
          widget=widget,
          html_out=buffer,
          title=title,
          requirejs=requirejs,
          connected=connected,
          full_html=full_html,
      )
      buffer.seek(0)
      return buffer.getvalue()
  
imports: import io
  import itertools
  import json
  import os
  import random
  import re
  import sys
  import typing
  from collections import defaultdict
  from copy import copy
  from datetime import datetime
  from decimal import Decimal
  from string import ascii_uppercase, digits
  import numpy
  import pandas
  from ipywidgets import Widget
  from ipywidgets.embed import dependency_state, embed_data, escape_script, snippet_template, widget_view_template
  from packaging.version import Version
  from pandas.core.dtypes.common import is_numeric_dtype
  import deepchecks
  from deepchecks import core
  from deepchecks.core.resources import jupyterlab_plotly_script, requirejs_script, suite_template, widgets_script
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 4 for calling a global function with example usage: widget_to_html_string(widget, title, requirejs, connected, full_html) and returns: buffer