def yearly_hours(activities, years=4):
    """ Get hours by year grouping """
    group_data = dict()
    for record in activities:
        if not record.cpd_expired(years):
            yr_grp = record.yr_grp
            if yr_grp not in group_data.keys():
                group_data[yr_grp] = 0
            total_hrs = record.total_hrs
            group_data[yr_grp] += total_hrs
    return group_data