code: def check_html(
      html, check_selects=True, plot_div_id="surface-plot", title=None
  ):
      """Performs several checks on raw HTML code."""
      fd, tmpfile = tempfile.mkstemp()
      try:
          os.close(fd)
          html.save_as_html(tmpfile)
          with open(tmpfile) as f:
              saved = f.read()
          # If present, replace Windows line-end '\r\n' with Unix's '\n'
          saved = saved.replace("\r\n", "\n")
          standalone = html.get_standalone().replace("\r\n", "\n")
          assert saved == standalone
      finally:
          os.remove(tmpfile)
      assert "INSERT" not in html.html
      assert html.get_standalone() == html.html
      assert html._repr_html_() == html.get_iframe()
      assert str(html) == html.get_standalone()
      assert '<meta charset="UTF-8" />' in str(html)
      resized = html.resize(3, 17)
      assert resized is html
      assert (html.width, html.height) == (3, 17)
      assert 'width="3" height="17"' in html.get_iframe()
      assert 'width="33" height="37"' in html.get_iframe(33, 37)
      if title is not None:
          assert f"<title>{title}</title>" in str(html)
      if not LXML_INSTALLED:
          return
      root = etree.HTML(
          html.html.encode("utf-8"),
          parser=etree.HTMLParser(huge_tree=True),
      )
      head = root.find("head")
      assert len(head.findall("script")) == 5
      body = root.find("body")
      div = body.find("div")
      assert ("id", plot_div_id) in div.items()
      if not check_selects:
          return
      selects = body.findall("select")
      assert len(selects) == 3
      hemi = selects[0]
      assert ("id", "select-hemisphere") in hemi.items()
      assert len(hemi.findall("option")) == 2
      kind = selects[1]
      assert ("id", "select-kind") in kind.items()
      assert len(kind.findall("option")) == 2
      view = selects[2]
      assert ("id", "select-view") in view.items()
      assert len(view.findall("option")) == 7
  
imports: import base64
  import os
  import re
  import tempfile
  import numpy
  import pytest
  from nilearn.datasets import fetch_surf_fsaverage
  from nilearn.plotting.js_plotting_utils import add_js_lib, colorscale, decode, encode, get_html_template, mesh_to_plotly, to_color_strings
  from nilearn.surface import load_surf_mesh
label_desc: Use image node_id 12 for calling a global function with example usage: check_html(html, check_selects, plot_div_id, title) without return types