code: def filter_tests_by_modulo(
      test_classes,
      modulo,
      modulo_index,
      split_by_tests,
      partition_mode="SEQUENTIAL",
  ):
      """
      >>> test_classes = {x: [x] for x in range(20)}
      >>> filter_tests_by_modulo(test_classes, 4, 0, False)
      {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]}
      >>> filter_tests_by_modulo(test_classes, 4, 1, False)
      {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]}
      >>> filter_tests_by_modulo(test_classes, 4, 2, False)
      {10: [10], 11: [11], 12: [12], 13: [13], 14: [14]}
  
      >>> dict(filter_tests_by_modulo(test_classes, 4, 0, True))
      {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]}
      >>> dict(filter_tests_by_modulo(test_classes, 4, 1, True))
      {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]}
      """
      if split_by_tests:
          tests = get_splitted_tests(
              flatten_tests(test_classes),
              modulo,
              modulo_index,
              partition_mode,
          )
          test_classes = collections.defaultdict(list)
          for class_name, test_name in tests:
              test_classes[class_name].append(test_name)
          return test_classes
      else:
          target_classes = get_splitted_tests(
              test_classes, modulo, modulo_index, partition_mode
          )
          return {
              class_name: test_classes[class_name]
              for class_name in target_classes
          }
  
imports: import collections
label_desc: Use image node_id 5 for calling a global function with example usage: filter_tests_by_modulo(test_classes, modulo, modulo_index, split_by_tests, partition_mode) and returns: test_classes, unknown