def METHOD_NAME(
    result: view_types.EvalResult,
    slicing_column: Optional[str] = None,
    slicing_spec: Optional[Union[slicer.SingleSliceSpec,
                                 config_pb2.SlicingSpec]] = None,
    weighted_example_column: Optional[str] = None,
    event_handlers: Optional[Callable[[Dict[str, Union[str, float]]],
                                      None]] = None,
) -> Optional[visualization.SlicingMetricsViewer]:  # pytype: disable=invalid-annotation
  """Renders the slicing metrics view as widget.
  Args:
    result: An tfma.EvalResult.
    slicing_column: The column to slice on.
    slicing_spec: The tfma.SlicingSpec to filter results. If neither column nor
      spec is set, show overall.
    weighted_example_column: Override for the weighted example column. This can
      be used when different weights are applied in different aprts of the model
      (eg: multi-head).
    event_handlers: The event handlers
  Returns:
    A SlicingMetricsViewer object if in Jupyter notebook; None if in Colab.
  """
  if slicing_spec and isinstance(slicing_spec, config_pb2.SlicingSpec):
    slicing_spec = slicer.SingleSliceSpec(spec=slicing_spec)
  data = util.get_slicing_metrics(result.slicing_metrics, slicing_column,
                                  slicing_spec)
  cfg = util.get_slicing_config(result.config, weighted_example_column)
  return visualization.METHOD_NAME(
      data, cfg, event_handlers=event_handlers)