import collections


def get_gt_distribution(experience, get_block):
    """
    Get the ground-truth distribution of an experience buffer.
    :param experience:      List of transitions.
    :param get_block:       Function that returns the ground-truth state-action block for each transition.
    :return:                Number of samples for each state-action block.
    """

    dist = collections.defaultdict(lambda: 0)

    for transition in experience:
        key = get_block(transition.state, transition.reward, transition.next_state)
        dist[key] += 1

    dist = dict(dist)
    return dist