class_docstr: Class which accepts html string and support displaying it in different environments.
class_docstr_tok: ["Class","which","accepts","html","string","and","support","displaying","it","in","different","environments","."]
docstr: Save the html to a file.
docstr_tok: ["Save","the","html","to","a","file","."]
code: def save_as_html(
      self, file: t.Union[str, io.TextIOWrapper, None] = None, **kwargs
  ) -> t.Optional[str]:
      """Save the html to a file."""
      if file is None:
          file = "output.html"
      if isinstance(file, str):
          file = create_new_file_name(file)
  
      if isinstance(file, str):
          with open(file, "w", encoding="utf-8") as f:
              f.write(self.html)
      elif isinstance(file, io.TextIOWrapper):
          file.write(self.html)
  
      return file
  
file_path: deepchecks/deepchecks/core/serialization/html_display.py
imports: import io
  import typing
  from ipywidgets import HTML, VBox, Widget
  from deepchecks.core.display import DisplayableResult
  from deepchecks.core.serialization.abc import HtmlSerializer, IPythonSerializer, WidgetSerializer
  from deepchecks.core.serialization.common import normalize_widget_style
  from deepchecks.utils.strings import create_new_file_name
label_desc: Use image node_id 8 for calling the HtmlDisplayableResult obj's underlying member method code with example usage: obj.save_as_html(file) and returns: file