def _create_buckets(size, years):
    """
    Assigns buckets for the given years, of a given size
    Args:
        size (int): Size of buckets in years
        years (list[int]): List of years to bucket (must be consecutive)

    Returns:
        dict: key=year, value=bucket_id
    """
    buckets = {}
    bucket_id = 1
    i = 0
    while i < len(years):
        bucket_years = years[i:i + size]
        for y in bucket_years:
            buckets[y] = bucket_id
        bucket_id += 1
        i += size
    return buckets