code: def prepared_data_to_html(
      data,
      d3_url=None,
      ldavis_url=None,
      ldavis_css_url=None,
      template_type="general",
      visid=None,
      use_http=False,
  ):
      """Output HTML with embedded visualization
  
      Parameters
      ----------
      data : PreparedData, created using :func:`prepare`
          The data for the visualization.
      d3_url : string (optional)
          The URL of the d3 library.  If not specified, a standard web path
          will be used.
      ldavis_url : string (optional)
          The URL of the LDAvis library.  If not specified, a standard web path
          will be used.
      template_type : string
          string specifying the type of HTML template to use. Options are:
  
          ``"simple"``
               suitable for a simple html page with one visualization.  Will
               fail if require.js is available on the page.
          ``"notebook"``
               assumes require.js and jquery are available.
          ``"general"``
               more complicated, but works both in and out of the
               notebook, whether or not require.js and jquery are available
      visid : string (optional)
          The html/css id of the visualization div, which must not contain spaces.
          If not specified, a random id will be generated.
      use_http : boolean (optional)
          If true, use http:// instead of https:// for d3_url and ldavis_url.
  
      Returns
      -------
      vis_html : string
          the HTML visualization
  
      See Also
      --------
      :func:`save_json`: save json representation of visualization to file
      :func:`save_html` : save html representation of a visualization to file
      :func:`show` : launch a local server and show a visualization in a browser
      :func:`display` : embed visualization within the IPython notebook
      :func:`enable_notebook` : automatically embed visualizations in IPython notebook
      """
      template = TEMPLATE_DICT[template_type]
  
      d3_url = d3_url or urls.D3_URL
      ldavis_url = ldavis_url or urls.LDAVIS_URL
      ldavis_css_url = ldavis_css_url or urls.LDAVIS_CSS_URL
  
      if use_http:
          d3_url = d3_url.replace("https://", "http://")
          ldavis_url = ldavis_url.replace("https://", "http://")
  
      if visid is None:
          visid = (
              "ldavis_"
              + get_id(data)
              + str(int(random.random() * 1e10))
          )
      elif re.search(r"\s", visid):
          raise ValueError("visid must not contain spaces")
  
      return template.render(
          visid=json.dumps(visid),
          visid_raw=visid,
          d3_url=d3_url,
          ldavis_url=ldavis_url,
          vis_json=data.to_json(),
          ldavis_css_url=ldavis_css_url,
      )
  
file_path: pyLDAvis/notebooks/pyLDAvis/_display.py
imports: import warnings
  import random
  import json
  import jinja2
  import re
  from pyLDAvis._server import serve
  from pyLDAvis.utils import get_id, write_ipynb_local_js, NumPyEncoder
  from pyLDAvis._prepare import PreparedData
  import pyLDAvis.urls
label_desc: Use image node_id 1 for calling a global function with example usage: prepared_data_to_html(data, d3_url, ldavis_url, ldavis_css_url, template_type, visid, use_http) and returns: template