'Return the query after applying the given limit and offset (if not None).'

def _apply_orm_limit_offset(self, query, limit, offset):

    if (limit is not None):
        query = query.limit(limit)
    if (offset is not None):
        query = query.offset(offset)
    return query
