code: def alerts(self, alert_level='High'):
          
          alerts = self.zap.core.alerts()
          alert_level_value = self.alert_levels[alert_level]
  
          alerts = sorted((a for a in alerts if self.alert_levels[a['risk']] >= alert_level_value),
                          key=lambda k: self.alert_levels[k['risk']], reverse=True)
  
          return alerts
docs: Get a filtered list of alerts at the given alert level, and sorted by alert level.