def unique(seq, idfunc=None):
if idfunc is None:<EOL><INDENT>idfunc = lambda x: x<EOL><DEDENT>preserved_type = type(seq)<EOL>seen = {}<EOL>result = []<EOL>for item in seq:<EOL><INDENT>marker = idfunc(item)<EOL>if marker in seen:<EOL><INDENT>continue<EOL><DEDENT>seen[marker] = <NUM_LIT:1><EOL>result.append(item)<EOL><DEDENT>return preserved_type(result)<EOL>
Unique a list or tuple and preserve the order

@type idfunc: Function or None
@param idfunc: If idfunc is provided it will be called during the
comparison process.