code: def _compress_with(input_filename, output_filename, compressors):
      
      with _temporary_filenames(len(compressors)) as temp_filenames:
          results = []
          for compressor, temp_filename in zip(compressors, temp_filenames):
              results.append(_process(compressor, input_filename, temp_filename))
          best_result = min(results)
          os.rename(best_result.filename, output_filename)
  
          best_compressor = best_result.compressor
          if best_result.size >= os.path.getsize(input_filename):
              best_compressor = None
  
          if (best_compressor is not None and
                  not _images_are_equal(input_filename, output_filename)):
              logging.info('Compressor "%s" generated an invalid image for "%s"',
                           best_compressor, input_filename)
              best_compressor = None
  
          if best_compressor is None:
              shutil.copy(input_filename, output_filename)
  
      logging.info('%s: best compressor for "%s"', best_compressor,
                   input_filename)
docs: Helper function to compress an image with several compressors.
  
      In case the compressors do not improve the filesize or in case the resulting
      image is not equivalent to the source, then the output will be a copy of the
      input.