def _trimxy_ranges(x, y, ranges):
    """ "
    Parameters
    ----------
    x : array-like
        x
    y : array-like
        y
    ranges : list, list[list]
        ranges in x as [xmin, xmax] to which y and y will be trimmed

    Returns
    -------
    trimmed_xy : list, list[list]
        x and y trimmed to ranges
    """

    if not isinstance(ranges[0], list):
        trim = (x > ranges[0]) & (x < ranges[1])
        return [x[trim], y[trim]]

    trimmed_xy = []

    for range in ranges:
        trim = (x > range[0]) & (x < range[1])
        trimmed_xy.append([x[trim], y[trim]])

    return trimmed_xy