#NEWLINE# def _remove_dups( L ) : #NEWLINE# #INDENT# '\n    Removes duplicates AND preserves the original order of the elements.\n    The set class is not guaranteed to do this.\n    ' #NEWLINE# seen_before = set ( [ ] ) #NEWLINE# L2 = [ ] #NEWLINE# for i in L : #NEWLINE# #INDENT# if ( i not in seen_before ) : #NEWLINE# #INDENT# seen_before . add ( i ) #NEWLINE# L2 . append ( i ) #NEWLINE# #UNINDENT# #UNINDENT# return L2