def get_study_period_ranges(data_length: int, test_period_length: int, study_period_length: int, index_name: str,
                            reverse=True,
                            verbose=1) -> dict:
    """
    Get study period ranges, going backwards in time, as a dict

    :param data_length: Number of total dates in index data
    :param test_period_length: Length of test period
    :param study_period_length: Length of study period
    :param index_name: Index name
    :param reverse: Reverse ranges
    :param verbose: Verbosity
    :return: Dict of study period ranges
    """

    n_full_periods = (data_length - (study_period_length - test_period_length)) // test_period_length
    remaining_days = (data_length - (study_period_length - test_period_length)) % test_period_length

    if verbose == 1:
        print(f'Data set contains {data_length} individual dates.')
        print(f'Available index history for {index_name} allows for {n_full_periods} overlapping study periods.')
        print(f'{remaining_days} days are excluded from study data.')

    study_period_ranges = {}
    for period in range(n_full_periods):
        study_period_ranges[period + 1] = (
            - (period * test_period_length + study_period_length), -(period * test_period_length + 1))

    if reverse:
        # Reverse dict such that most recent period has largest index
        dict_len = len(study_period_ranges.keys())
        study_period_ranges = {dict_len - key + 1: value for key, value in study_period_ranges.items()}

    return study_period_ranges