code: def get_fig(html):
      # strip off all the rest of the html and js
      fig_str = html[html.index("[{", html.rindex("Plotly.newPlot(")) :]
      fig_str = fig_str[: fig_str.index("}    ") + 1]
      data, layout, config = json.loads(
          f"[{fig_str}]", parse_float=clean_float
      )
      fig_dict = dict(data=data, layout=layout, config=config)
      return json.dumps(fig_dict, indent=2).splitlines(keepends=True)
  
imports: import difflib
  import json
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: get_fig(html) and returns: json