nodes: 0, module; 1, function_definition; 2, function_name:alerts; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:alert_level; 13, string; 14, comment:"""Get a filtered list of alerts at the given alert level, and sorted by alert level."""; 15, assignment; 16, assignment; 17, assignment; 18, identifier:alerts; 19, string_content:High; 20, identifier:alerts; 21, call; 22, identifier:alert_level_value; 23, subscript; 24, identifier:alerts; 25, call; 26, attribute; 27, argument_list; 28, attribute; 29, identifier:alert_level; 30, identifier:sorted; 31, argument_list; 32, attribute; 33, identifier:alerts; 34, identifier:self; 35, identifier:alert_levels; 36, generator_expression; 37, keyword_argument; 38, keyword_argument; 39, attribute; 40, identifier:core; 41, identifier:a; 42, for_in_clause; 43, if_clause; 44, identifier:key; 45, lambda; 46, identifier:reverse; 47, True; 48, identifier:self; 49, identifier:zap; 50, identifier:a; 51, identifier:alerts; 52, comparison_operator:self.alert_levels[a['risk']] >= alert_level_value; 53, lambda_parameters; 54, subscript; 55, subscript; 56, identifier:alert_level_value; 57, identifier:k; 58, attribute; 59, subscript; 60, attribute; 61, subscript; 62, identifier:self; 63, identifier:alert_levels; 64, identifier:k; 65, string; 66, identifier:self; 67, identifier:alert_levels; 68, identifier:a; 69, string; 70, string_content:risk; 71, string_content:risk
code: def alerts(self, alert_level='High'):
          """Get a filtered list of alerts at the given alert level, and sorted by alert level."""
          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