def _get_itakura_slopes(n_timestamps_1, n_timestamps_2, max_slope):
    """Compute the slopes of the parallelogram bounds."""
    if not isinstance(n_timestamps_1, (int, np.integer)):
        raise TypeError("'n_timestamps_1' must be an integer.")
    else:
        if not n_timestamps_1 >= 2:
            raise ValueError("'n_timestamps_1' must be an integer greater than"
                             " or equal to 2.")

    if not isinstance(max_slope, (int, np.integer, float, np.floating)):
        raise TypeError("'max_slope' must be an integer or a float.")
    else:
        if not max_slope >= 1:
            raise ValueError("'max_slope' must be a number greater "
                             "than or equal to 1.")

    min_slope = 1 / max_slope
    scale_max = (n_timestamps_2 - 1) / (n_timestamps_1 - 2)
    max_slope *= scale_max
    max_slope = max(1., max_slope)

    scale_min = (n_timestamps_2 - 2) / (n_timestamps_1 - 1)

    min_slope *= scale_min
    min_slope = min(1., min_slope)
    return min_slope, max_slope
Compute the slopes of the parallelogram bounds.
pyts/metrics/dtw.py