def METHOD_NAME(self, task, config):
    if config is False:
        return
    config = self.prepare_config(config)
    max_count = config['max_retries']
    for entry in task.entries:
        item = (
            task.session.query(db.FailedEntry)
            .filter(db.FailedEntry.title == entry['title'])
            .filter(db.FailedEntry.url == entry['original_url'])
            .first()
        )
        if item:
            if item.count > max_count:
                entry.reject(
                    f'Has already failed {item.count} times in the past. (failure reason: {item.reason})'
                )
            elif item.retry_time and item.retry_time > datetime.now():
                entry.reject(
                    'Waiting before retrying entry which has failed in the past. (failure reason: %s)'
                    % item.reason
                )