def METHOD_NAME(queryset):
    """Slice a queryset into batches.
    Input queryset should be sorted be pk.
    """
    start_pk = 0
    while True:
        qs = queryset.order_by("pk").filter(pk__gt=start_pk)[:2000]
        pks = list(qs.values_list("pk", flat=True))
        if not pks:
            break
        yield pks
        start_pk = pks[-1]