'Parse a WMI Event Consumer.'

def Parse(self, query, result, knowledge_base):

    _ = (query, knowledge_base)
    wmi_dict = result.ToDict()
    try:
        wmi_dict['CreatorSID'] = BinarySIDtoStringSID(''.join([chr(i) for i in wmi_dict['CreatorSID']]))
    except (ValueError, TypeError) as e:
        wmi_dict['CreatorSID'] = str(wmi_dict['CreatorSID'])
    except KeyError as e:
        pass
    for output_type in self.output_types:
        anomalies = []
        output = rdfvalue.RDFValue.classes[output_type]()
        for (k, v) in wmi_dict.iteritems():
            try:
                output.Set(k, v)
            except AttributeError as e:
                anomalies.append(('Unknown    field    %s,    with    value    %s' % (k, v)))
            except ValueError as e:
                anomalies.append(('Invalid    value    %s    for    field    %s:    %s' % (v, k, e)))
        if anomalies:
            (yield rdf_anomaly.Anomaly(type='PARSER_ANOMALY', generated_by=self.__class__.__name__, finding=anomalies))
        if (wmi_dict and (not output)):
            raise ValueError('Non-empty    dict    %s    returned    empty    output.', wmi_dict)
        (yield output)
