class_docstr: Auxiliary class to decouple display handling logic from other functionality.
class_docstr_tok: ["Auxiliary","class","to","decouple","display","handling","logic","from","other","functionality","."]
docstr: Handle plotly figure item.
docstr_tok: ["Handle","plotly","figure","item","."]
code: def handle_figure(
      cls,
      item: BaseFigure,
      index: int,
      plotly_to_image: bool = False,
      **kwargs,
  ):
      """Handle plotly figure item."""
      return (
          item
          if not plotly_to_image
          else Image(
              data=item.to_image(format="jpeg", engine="auto"),
              format="jpeg",
          )
      )
  
imports: import typing
  from IPython.display import HTML, Image
  from plotly.basedatatypes import BaseFigure
  from deepchecks.core import check_result
  from deepchecks.core.serialization.abc import IPythonFormatter, IPythonSerializer
  from deepchecks.core.serialization.common import flatten
  from deepchecks.core.serialization.dataframe.html import DataFrameSerializer
  from .None import html
label_desc: Use image node_id 8 for calling the DisplayItemsHandler obj's underlying member method code with example usage: obj.handle_figure(cls, item, index, plotly_to_image) and returns: unknown