code: def select_serializer(result):
      if isinstance(result, check_types.CheckResult):
          return CheckResultWidgetSerializer(result)
      elif isinstance(result, check_types.CheckFailure):
          return CheckFailureWidgetSerializer(result)
      else:
          raise TypeError(f"Unknown type of result - {type(result)}")
  
imports: import typing
  import warnings
  from ipywidgets import HTML, Accordion, VBox, Widget
  from deepchecks.core import check_result
  from deepchecks.core import suite
  from deepchecks.core.serialization.abc import WidgetSerializer
  from deepchecks.core.serialization.check_failure.widget import CheckFailureSerializer
  from deepchecks.core.serialization.check_result.widget import CheckResultSerializer
  from deepchecks.core.serialization.common import Html
  from deepchecks.core.serialization.common import aggregate_conditions, create_failures_dataframe, create_results_dataframe, form_output_anchor, join, normalize_widget_style
  from deepchecks.core.serialization.dataframe.widget import DataFrameSerializer
  from deepchecks.utils.dataframes import hide_index_for_display
  from deepchecks.utils.strings import get_random_string
  from .None import html
label_desc: Use image node_id 1 for calling a global function with example usage: select_serializer(result) and returns: CheckResultWidgetSerializer, CheckFailureWidgetSerializer