def limited(items, request, max_limit=FLAGS.osapi_max_limit):
    try:
        offset = int(request.GET.get('offset', 0))
    except ValueError:
        msg = _('offset param must be an integer')
        raise webob.exc.HTTPBadRequest(explanation=msg)

    try:
        limit = int(request.GET.get('limit', max_limit))
    except ValueError:
        msg = _('limit param must be an integer')
        raise webob.exc.HTTPBadRequest(explanation=msg)

    if limit < 0:
        msg = _('limit param must be positive')
        raise webob.exc.HTTPBadRequest(explanation=msg)

    if offset < 0:
        msg = _('offset param must be positive')
        raise webob.exc.HTTPBadRequest(explanation=msg)

    limit = min(max_limit, limit or max_limit)
    range_end = offset + limit
    return items[offset:range_end]
An Index object describing the index.
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/api/openstack/common.py/limited--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py/IndexState.definition