code: def widgets_script(
      connected: bool = True, amd_module: bool = False
  ) -> str:
      """Return ipywidgets javascript library.
  
      Parameters
      ----------
      connected : bool, default True
          whether to use CDN or not
      amd_module : bool, default False
          whether to use requirejs compatiable module or not
  
      Returns
      -------
      str
      """
      if connected is True:
          url = (
              f"https://unpkg.com/@jupyter-widgets/html-manager@{__html_manager_version__}/dist/embed-amd.js"
              if amd_module is True
              else f"https://unpkg.com/@jupyter-widgets/html-manager@{__html_manager_version__}/dist/embed.js"
          )
          return (
              f'<script src="{url}" crossorigin="anonymous"></script>'
          )
      else:
          asset_name = (
              "widgets-embed-amd.js"
              if amd_module is True
              else "widgets-embed.js"
          )
          path = os.path.join("core", "resources", asset_name)
          js = pkgutil.get_data("deepchecks", path)
  
          if js is None:
              raise RuntimeError(
                  "Did not find widgets javascript assets"
              )
  
          js = js.decode("utf-8")
          return f'<script type="text/javascript">{js}</script>'
  
file_path: deepchecks/deepchecks/core/resources/__init__.py
imports: import os
  import pkgutil
  import textwrap
  from ipywidgets.embed import __html_manager_version__
label_desc: Use image node_id 2 for calling a global function with example usage: widgets_script(connected, amd_module) and returns: str, url, str, str, js, str