def iterdupes(self, compare=None, filt=None):
if not compare: compare = self.md5sum<EOL>seen_siz = {}       <EOL>seen_sum = {}       <EOL>size_func = lambda x: os.stat(x).st_size<EOL>for (fsize, f) in self.iteritems(want_dirs=False, func=size_func, filt=filt):<EOL><INDENT>if fsize not in seen_siz:    <EOL><INDENT>seen_siz[fsize] = f<EOL>continue<EOL><DEDENT>else:<EOL><INDENT>if seen_siz[fsize]:      <EOL><INDENT>chksum = compare(seen_siz[fsize])<EOL>if chksum in seen_sum:  yield (chksum, seen_siz[fsize])<EOL>else:                   seen_sum[chksum] = seen_siz[fsize]<EOL>seen_siz[fsize] = None<EOL><DEDENT>chksum = compare(f)<EOL>if chksum in seen_sum:<EOL><INDENT>if seen_sum[chksum]:<EOL><INDENT>yield (chksum, seen_sum[chksum])<EOL>seen_sum[chksum] = None<EOL><DEDENT>yield (chksum, f)<EOL><DEDENT>else:<EOL><INDENT>seen_sum[chksum] = f<EOL><DEDENT><DEDENT><DEDENT>
streaming item iterator with low overhead duplicate file detection

            Parameters:
                - compare       compare function between files (defaults to md5sum)