code: def parse_alert(output):
      
      for x in output.splitlines():
          match = ALERT_PATTERN.match(x)
          if match:
              rec = {'timestamp': datetime.strptime(match.group('timestamp'),
                                                    '%m/%d/%y-%H:%M:%S.%f'),
                     'sid': int(match.group('sid')),
                     'revision': int(match.group('revision')),
                     'priority': int(match.group('priority')),
                     'message': match.group('message'),
                     'source': match.group('src'),
                     'destination': match.group('dest'),
                     'protocol': match.group('protocol'),
                     }
              if match.group('classtype'):
                  rec['classtype'] = match.group('classtype')
              yield rec
docs: Parses the supplied output and yields any alerts.
  
      Example alert format:
      01/28/14-22:26:04.885446  [**] [1:1917:11] INDICATOR-SCAN UPnP service discover attempt [**] [Classification: Detection of a Network Scan] [Priority: 3] {UDP} 10.1.1.132:58650 -> 239.255.255.250:1900
  
      :param output: A string containing the output of running snort
      :returns: Generator of snort alert dicts