def _get_quantile_intervals(
    vals: np.ndarray,
    q: tuple[Sequence[float], Any],
    q_interval: np.ndarray = None,
) -> tuple[np.ndarray, np.ndarray]:
    """Returns the lower and upper bound values from `vals` for all quantile intervals in `q_interval`.

    Parameters
    ----------
    vals
        A numpy array with predicted quantile values of shape (n times, n components, n quantiles).
    q
        A tuple with (quantile values, any).
    q_interval
        A numpy array with the lower and upper quantile interval bound of shape (n intervals, 2).
    """
    q, _ = q
    # find index of every `q_interval` value in `q`; we have guarantees from support wrappers:
    # - `q` has increasing order
    # - `vals` has same order as `q` in dim 3 (quantile dim)
    # - `q_interval` holds (lower q, upper q) in that order
    q_idx = np.searchsorted(q, q_interval.flatten()).reshape(q_interval.shape)
    return vals[:, :, q_idx[:, 0]], vals[:, :, q_idx[:, 1]]
Returns the lower and upper bound values from `vals` for all quantile intervals in `q_interval`.

    Parameters
    ----------
    vals
        A numpy array with predicted quantile values of shape (n times, n components, n quantiles).
    q
        A tuple with (quantile values, any).
    q_interval
        A numpy array with the lower and upper quantile interval bound of shape (n intervals, 2).
    
darts/metrics/metrics.py