code: def to_dict(
      self, example_to_dict_fn=None, n=None, seed=None, new_sample=False
  ):
      if example_to_dict_fn is None:
          try:
              example_to_dict_fn = self.example_to_dict_fn
          except AttributeError:
              raise (
                  Exception(
                      "suite does not have example_to_dict_fn, must pass function as argument."
                  )
              )
      examples = self.get_raw_examples(
          format_fn=lambda x: x, n=n, seed=seed, new_sample=new_sample
      )
      data_keys = list(example_to_dict_fn(examples[0]).keys())
      keys = data_keys + ["test_name", "test_case", "example_idx"]
      hf_dict = {k: [] for k in keys}
      for e in examples:
          m = example_to_dict_fn(e)
          for k, v in m.items():
              hf_dict[k].append(v)
      for test_name, r in sorted(
          self.test_ranges.items(), key=lambda x: x[1][0]
      ):
          test = self.tests[test_name]
          size = r[1] - r[0]
          hf_dict["test_name"].extend([test_name for _ in range(size)])
          hf_dict["test_case"].extend(test.result_indexes)
          cnt = collections.defaultdict(lambda: 0)
          example_idx = []
          for i in test.result_indexes:
              example_idx.append(cnt[i])
              cnt[i] += 1
          hf_dict["example_idx"].extend(example_idx)
      return hf_dict
  
imports: import collections
  from collections import defaultdict, OrderedDict
  import dill
  import json
  from .abstract_test import load_test, read_pred_file
  from .test_types import MFT, INV, DIR
  from .viewer.suite_summarizer import SuiteSummarizer
label_desc: Use image node_id 5 for calling the TestSuite obj's underlying member method code with example usage: obj.to_dict(example_to_dict_fn, n, seed, new_sample) and returns: hf_dict