code: def _get_plot_js(
      config: AxPlotConfig,
      plot_module_name: str,
      plot_resources: Dict[enum.Enum, str],
      plotdivid: str,
  ) -> str:
      """Convert plot config to corresponding JS code."""
      if not isinstance(config, AxPlotConfig):
          raise ValueError("Config must be instance of AxPlotConfig.")
      js_template = pkgutil.get_data(
          plot_module_name,
          os.path.join("js", plot_resources[config.plot_type]),
      )
      if js_template is None:
          raise ValueError(
              f"Cannot find JS template {plot_resources[config.plot_type]}."
          )
      return Template(js_template.decode("utf8")).render(
          id=json.dumps(plotdivid),
          **{k: json.dumps(v) for k, v in config.data.items()},
      )
  
file_path: Ax/ax/plot/render.py
imports: import enum
  import json
  import os
  import pkgutil
  import uuid
  from typing import Dict
  import plotly.offline
  from ax.plot.base import AxPlotConfig, AxPlotTypes
  from jinja2 import Template
label_desc: Use image node_id 4 for calling a global function with example usage: _get_plot_js(config, plot_module_name, plot_resources, plotdivid) and returns: Template