def trim_dataset(dataset):
    """ Trim datasets such that first and last year of data have all 12 months

    :param dataset: Dataset object
    :type dataset: :class:`dataset.Dataset`

    :returns: Slice index for trimmed dataset
    """
    start_time, end_time = dataset.temporal_boundaries()
    start_month = 13 if start_time.month == 1 else start_time.month
    end_month = 0 if end_time.month == 12 else end_time.month
    slc = slice(13 - start_month, len(dataset.times) - end_month)
    return slc
