code: async def preProcessForComparison(results, target_size, size_tolerance_prct):
      reference = None
      for result in results:
        if result.source_quality is CoverSourceQuality.REFERENCE:
          if ((reference is None) or
              (CoverSourceResult.compare(result,
                                         reference,
                                         target_size=target_size,
                                         size_tolerance_prct=size_tolerance_prct) > 0)):
            reference = result
      results = list(itertools.filterfalse(operator.attrgetter("is_only_reference"), results))
      no_dup_results = []
      for result in results:
        is_dup = False
        for result_comp in results:
          if ((result_comp is not result) and
              (result_comp.urls == result.urls) and
              (__class__.compare(result,
                                 result_comp,
                                 target_size=target_size,
                                 size_tolerance_prct=size_tolerance_prct) < 0)):
            is_dup = True
            break
        if not is_dup:
          no_dup_results.append(result)
      dup_count = len(results) - len(no_dup_results)
      if dup_count > 0:
        logging.getLogger("Cover").info("Removed %u duplicate results" % (dup_count))
        results = no_dup_results
      if reference is not None:
        logging.getLogger("Cover").info("Reference is: %s" % (reference))
        reference.is_similar_to_reference = True
        futures = []
        for result in results:
          coroutine = result.updateSignature()
          future = asyncio.ensure_future(coroutine)
          futures.append(future)
        if reference.is_only_reference:
          assert(reference not in results)
          coroutine = reference.updateSignature()
          future = asyncio.ensure_future(coroutine)
          futures.append(future)
        if futures:
          await asyncio.wait(futures)
        for future in futures:
          future.result()
        for result in results:
          if ((result is not reference) and
                  (result.thumbnail_sig is not None) and
                  (reference.thumbnail_sig is not None)):
            result.is_similar_to_reference = __class__.areImageSigsSimilar(result.thumbnail_sig,
                                                                           reference.thumbnail_sig)
            if result.is_similar_to_reference:
              logging.getLogger("Cover").debug("%s is similar to reference" % (result))
            else:
              logging.getLogger("Cover").debug("%s is NOT similar to reference" % (result))
      else:
        logging.getLogger("Cover").warning("No reference result found")
      return results