code: def _build_resize_script(plotdivid, plotly_root="Plotly"):
      resize_script = (
          '<script type="text/javascript">'
          'window.addEventListener("resize", function(){{'
          'if (document.getElementById("{id}")) {{'
          '{plotly_root}.Plots.resize(document.getElementById("{id}"));'
          "}};}})"
          "</script>"
      ).format(plotly_root=plotly_root, id=plotdivid)
      return resize_script
  
file_path: plotly.py/packages/python/plotly/plotly/offline/offline.py
imports: import os
  import warnings
  import pkgutil
  from plotly.optional_imports import get_module
  from plotly import tools
  from ._plotlyjs_version import __plotlyjs_version__
label_desc: Use image node_id 4 for calling a global function with example usage: _build_resize_script(plotdivid, plotly_root) and returns: resize_script