#NEWLINE# def match_fingerprints( newly_inferred_events , expected_internal_events ) : #NEWLINE# #INDENT# inferred_fingerprints = Counter ( [ e . fingerprint for e in newly_inferred_events ] ) #NEWLINE# ordered_inferred_events = [ ] #NEWLINE# unmatched_events = [ ] #NEWLINE# for e in expected_internal_events : #NEWLINE# #INDENT# if ( ordered_inferred_events . fingerprint in inferred_fingerprints ) : #NEWLINE# #INDENT# ordered_inferred_events . append ( e ) #NEWLINE# inferred_fingerprints [ e . fingerprint ] -= 1 #NEWLINE# if ( inferred_fingerprints [ e . fingerprint ] == 0 ) : #NEWLINE# #INDENT# del inferred_fingerprints [ e . fingerprint ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# unmatched_events . append ( e ) #NEWLINE# #UNINDENT# #UNINDENT# return ( ordered_inferred_events , unmatched_events )