docs: def anneal(self, mode, matches, orig_matches):
          """ Perform post-processing.
  
              Return True when any changes were applied.
          """
          changed = False
  
          def dupes_in_matches():
              """Generator for index of matches that are dupes."""
              items_by_path = config.engine.group_by('realpath')
              hashes = set([x.hash for x in matches])
              for idx, item in enumerate(matches):
                  same_path_but_not_in_matches = any(
                      x.hash not in hashes
                      for x in items_by_path.get(item.realpath, [])
                  )
                  if item.realpath and same_path_but_not_in_matches:
                      yield idx
  
          if mode == 'dupes+':
              items_by_path = config.engine.group_by('realpath')
              hashes = set([x.hash for x in matches])
              dupes = []
              for item in matches:
                  if item.realpath:
                      # Add all items with the same path that are missing
                      for dupe in items_by_path.get(item.realpath, []):
                          if dupe.hash not in hashes:
                              changed = True
                              dupes.append(dupe)
                              hashes.add(dupe.hash)
              matches.extend(dupes)
          elif mode == 'dupes-':
              for idx in reversed(list(dupes_in_matches())):
                  changed = True
                  del matches[idx]
          elif mode == 'dupes=':
              items_by_path = config.engine.group_by('realpath')
              dupes = list(i for i in matches if i.realpath and len(items_by_path.get(i.realpath, [])) > 1)
              if len(dupes) != len(matches):
                  changed = True
                  matches[:] = dupes
          elif mode == 'invert':
              hashes = set([x.hash for x in matches])
              changed = True
              matches[:] = list(i for i in orig_matches if i.hash not in hashes)
          elif mode == 'unique':
              seen, dupes = set(), []
              for i, item in enumerate(matches):
                  if item.name in seen:
                      changed = True
                      dupes.append(i)
                  seen.add(item.name)
              for i in reversed(dupes):
                  del matches[i]
          else:
              raise RuntimeError('Internal Error: Unknown anneal mode ' + mode)
  
          return changed