from typing import List
import collections


def get_class_frequencies(records: List[dict]):
    """ counts the number of examples belonging to each label, and returns a dict
    """
    all_labels = [entry['label'] for entry in records]
    counter = collections.Counter(all_labels)
    return dict(counter)