def _add_fallback_slice_filter(query, start_int, count_int, total_int):
    """Create a slice of a query based on request start and count parameters.

    This adds `OFFSET <start> LIMIT <count>` to the SQL query, which causes slicing to
    run very slowly on large result sets.

    """
    logging.debug(
        'Adding fallback slice filter. start={} count={} total={} '.format(
            start_int, count_int, total_int
        )
    )
    if not count_int:
        return query.none()
    else:
        return query[start_int : start_int + count_int]
Create a slice of a query based on request start and count parameters.

    This adds `OFFSET <start> LIMIT <count>` to the SQL query, which causes slicing to
    run very slowly on large result sets.