def find_matches(self, min_hamming, max_hamming):
    assert min_hamming <= max_hamming
    assert max_hamming <= 12, 'accuracy not guaranteed for distance > 12'
    seen = set()
    for tag, lst in self.index.iteritems():
      for fn1, fp1 in lst:
        for fn2, fp2 in lst:
          if fn1 == fn2:
            continue
          key = tuple(sorted([fn1, fn2]))
          if key in seen:
            continue
          seen.add(key)
          dist = distance(fp1, fp2)
          if min_hamming <= dist <= max_hamming:
            print '%s\t%s\t%d' % (fn1, fn2, dist)
dataset/ETHPy150Open viewfinderco/viewfinder/experimental/imagefingerprint/tools/find_near_dupes.py/Index.find_matches/original