def check_bounds(bounds, virtual_dset):

    if type(bounds) != tuple and type(bounds) != slice:
        raise BadRequest('The provided parameter, bounds, is not a tuple as expected.')
    if type(bounds) == tuple and len(bounds) > len(virtual_dset.shape):
        raise BadRequest('The provided parameter, bounds, is trying to restrict more dimensions '
                         'than the how many are actually present in the data.')
A method that checks the validity of user provided bounds
dataset/ETHPy150Open ooici/pyon/prototype/hdf/hdf_array_iterator.py/check_bounds