code: def snapshot_mpld3_plot(
      plot_filename, output_folder, output_file_path=None
  ):
      assert (
          output_file_path or output_folder
      ), "output_file_path or output_folder is required"
      result = visualize_tests.ExecFile(plot_filename)
      figures = {}
      html_fig_id_format = "fig{fig_id:03d}"
      html_fig_ids = []
      for fig_id, (fig, extra_js, extra_css) in enumerate(
          result.iter_json()
      ):
          figures.setdefault("js", []).append(
              JS_TEMPLATE.format(
                  figid=fig_id, figure_json=fig, extra_js=extra_js
              )
          )
          figures.setdefault("html", []).append(
              MPLD3_TEMPLATE.format(figid=fig_id)
          )
          html_fig_ids.append(html_fig_id_format.format(fig_id=fig_id))
  
      if not figures.get("html"):
          return
      figures_html = "".join(figures.get("html"))
      js_script = "".join(figures.get("js"))
  
      rendered = HTML_TEMPLATE.format(
          figures=figures_html, js_commands=js_script, extra_css=""
      )
  
      temp_folder = os.path.join(output_folder, "temp/")
      output_html_path = os.path.join(
          temp_folder, "_snapshot_{id}.html".format(id=uuid.uuid4().hex)
      )
  
      if not os.path.exists(temp_folder):
          os.makedirs(temp_folder)
      f = open(output_html_path, "w+")
      f.write(rendered)
      f.close()
  
      if not output_file_path:
          output_file_path = snapshot_path(plot_filename, output_folder)
  
      command = [
          mpld3.SCREENSHOT_BIN,
          output_html_path,
          output_file_path,
          mpld3.urls.D3_LOCAL,
          mpld3.urls.MPLD3_LOCAL,
      ]
      subprocess.check_call(command)
  
      os.remove(output_html_path) if os.path.exists(
          output_html_path
      ) else None
      return output_file_path
  
file_path: mpld3/mpld3/tests/export.py
imports: import uuid
  import subprocess
  import mpld3
  import multiprocessing
  import os
  import diffimg
  import visualize_tests
  from functools import partial
label_desc: Use image node_id 2 for calling a global function with example usage: snapshot_mpld3_plot(plot_filename, output_folder, output_file_path) and returns: output_file_path