code: def assert_result_dataframe(
      df: pd.DataFrame,
      duplicate_variants: t.Optional[
          t.Sequence[AmbiguousDuplicatVariant]
      ] = None,
  ):
      assert_that(
          df.index.names, equal_to(["Duplicate", "Sample ID", "Label"])
      )
      assert_that(df.columns, equal_to(["Text"]))
  
      if len(df) == 0:
          return
      if duplicate_variants is None:
          return
  
      grouped = df.reset_index().groupby(["Duplicate"])
      data = grouped.aggregate(lambda x: x.to_list())
  
      for idx, variant in enumerate(duplicate_variants):
          variant_data = dict(data.loc[idx])
          assert_that(
              variant_data["Sample ID"], equal_to(variant.sample_ids)
          )
          assert_that(variant_data["Label"], equal_to(variant.labels))
          assert_that(variant_data["Text"], equal_to(variant.text))
  
imports: import typing
  import pandas
  import pytest
  from hamcrest import *
  from deepchecks.nlp.checks import ConflictingLabels
  from deepchecks.nlp.text_data import TextData
  from deepchecks.utils.strings import format_percent
  from tests.base.utils import equal_condition_result
label_desc: Use image node_id 7 for calling a global function with example usage: assert_result_dataframe(df, duplicate_variants) without return types