@classmethod
    def recent_high_abuse_reports(cls, threshold, period, addon_id=None,
                                  addon_type=None):
        abuse_sql = ['''
            SELECT `abuse_reports`.*,
                   COUNT(`abuse_reports`.`addon_id`) AS `num_reports`
            FROM `abuse_reports`
            INNER JOIN `addons` ON (`abuse_reports`.`addon_id` = `addons`.`id`)
            WHERE `abuse_reports`.`created` >= %s ''']
        params = [period]
        if addon_id:
            abuse_sql.append('AND `addons`.`id` = %s ')
            params.append(addon_id)
        elif addon_type and addon_type in amo.ADDON_TYPES:
            abuse_sql.append('AND `addons`.`addontype_id` = %s ')
            params.append(addon_type)
        abuse_sql.append('GROUP BY addon_id HAVING num_reports > %s')
        params.append(threshold)

        return list(cls.objects.raw(''.join(abuse_sql), params))
Helper method that can be called when ``value`` is deemed invalid.
dataset/ETHPy150Open mozilla/addons-server/src/olympia/abuse/models.py/AbuseReport.recent_high_abuse_reports--crossover with--dataset/ETHPy150Open sdispater/cleo/cleo/validators/__init__.py/Validator.error