<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _ls_print_summary(all_trainings: List[Tuple[str, dict, TrainingTrace]]) -> None: """ Print trainings summary. In particular print tables summarizing the number of trainings with - particular model names - particular combinations of models and datasets :param all_trainings: a list of training tuples (train_dir, configuration dict, trace) """

    counts_by_name = defaultdict(int)
    counts_by_classes = defaultdict(int)
    for _, config, _ in all_trainings:
        counts_by_name[get_model_name(config)] += 1
        counts_by_classes[get_classes(config)] += 1

    print_boxed('summary')
    print()

    counts_table = [[name, count] for name, count in counts_by_name.items()]
    print(tabulate(counts_table, headers=['model.name', 'count'], tablefmt='grid'))
    print()

    counts_table = [[classes[0], classes[1], count] for classes, count in counts_by_classes.items()]
    print(tabulate(counts_table, headers=['model.class', 'dataset.class', 'count'], tablefmt='grid'))
    print()