code: def assert_widget_output(
      output,
      check_result,
      with_conditions_section=True,
      with_display_section=True,
  ):
      children_count = 4
      header_section_index = 0
      summary_section_index = 1
      conditions_section_index = 2
      display_section_index = 3
  
      if (
          with_conditions_section is False
          and with_display_section is False
      ):
          children_count = 2
      elif (
          with_conditions_section is False
          and with_display_section is True
      ):
          children_count = 3
          display_section_index = 2
      elif (
          with_conditions_section is False
          or with_display_section is False
      ):
          children_count = 3
  
      assert_that(
          output,
          all_of(
              instance_of(VBox),
              has_property(
                  "children",
                  all_of(
                      instance_of(tuple), has_length(children_count)
                  ),
              ),
          ),
      )
  
      assert_that(
          output.children[header_section_index],
          all_of(
              instance_of(HTML),
              has_property(
                  "value",
                  all_of(
                      instance_of(str),
                      contains_string(check_result.header),
                  ),
              ),
          ),
      )
      assert_that(
          output.children[summary_section_index],
          all_of(
              instance_of(HTML),
              has_property(
                  "value",
                  all_of(
                      instance_of(str),
                      contains_string(t.cast(str, DummyCheck.__doc__)),
                  ),
              ),
          ),
      )
  
      if with_conditions_section is True:
          assert_that(
              output.children[conditions_section_index],
              instance_of(HTML),
          )
  
      if with_display_section is True:
          assert_that(
              output.children[display_section_index],
              all_of(
                  instance_of(VBox),
                  has_property(
                      "children",
                      all_of(
                          instance_of(tuple),
                          has_length(
                              equal_to(len(check_result.display) + 1)
                          ),
                      ),
                  ),
              ),  # plus header element
          )
  
imports: import json
  import typing
  import pandas
  import wandb
  from hamcrest import all_of, assert_that, calling, contains_exactly, contains_string, equal_to, greater_than, has_entries, has_item, has_length, has_property, instance_of, matches_regexp, only_contains, raises, starts_with
  from IPython.display import Image
  from ipywidgets import HTML, Tab, VBox
  from pandas.io.formats.style import Styler
  from plotly.basedatatypes import BaseFigure
  from deepchecks.core.check_result import DisplayMap
  from deepchecks.core.serialization.check_result.html import CheckResultSerializer
  from deepchecks.core.serialization.check_result.html import DisplayItemsHandler
  from deepchecks.core.serialization.check_result.ipython import CheckResultSerializer
  from deepchecks.core.serialization.check_result.ipython import DisplayItemsHandler
  from deepchecks.core.serialization.check_result.json import CheckResultSerializer
  from deepchecks.core.serialization.check_result.json import DisplayItemsHandler
  from deepchecks.core.serialization.check_result.junit import CheckResultSerializer
  from deepchecks.core.serialization.check_result.wandb import CheckResultSerializer
  from deepchecks.core.serialization.check_result.widget import CheckResultSerializer
  from deepchecks.core.serialization.check_result.widget import DisplayItemsHandler
  from deepchecks.core.serialization.common import plotlyjs_script
  from deepchecks.utils.strings import get_random_string
  from tests.common import DummyCheck, create_check_result, create_check_result_display, instance_of_ipython_formatter
label_desc: Use image node_id 45 for calling a global function with example usage: assert_widget_output(output, check_result, with_conditions_section, with_display_section) without return types