@classmethod
    def get_errors_to_process(cls, utcnow, limit=None, skip=0, fetch_full=False):
        max_attempts = settings.PILLOW_RETRY_QUEUE_MAX_PROCESSING_ATTEMPTS
        multi_attempts_cutoff = cls.multi_attempts_cutoff()
        query = PillowError.objects \
            .filter(queued=False) \
            .filter(date_next_attempt__lte=utcnow) \
            .filter(
                models.Q(current_attempt=0) |
                (models.Q(total_attempts__lte=multi_attempts_cutoff) & models.Q(current_attempt__lte=max_attempts))
            )

        # temporarily disable queuing of ConfigurableReportKafkaPillow errors
        query = query.filter(~models.Q(pillow='corehq.apps.userreports.pillow.ConfigurableReportKafkaPillow'))

        if not fetch_full:
            query = query.values('id', 'date_next_attempt')
        if limit is not None:
            return query[skip:skip+limit]
        else:
            return query
Tests the target returned by an alias with multiple targets
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/pillow_retry/models.py/PillowError.get_errors_to_process--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/modules/aliases_test.py/AliasesTestCase.test_get_target_mult