code: def needs_invalidation(self, requirement, cache_file):
          
          if self.config.trust_mod_times:
              return requirement.last_modified > os.path.getmtime(cache_file)
          else:
              checksum = self.recall_checksum(cache_file)
              return checksum and checksum != requirement.checksum
docs: Check whether a cached binary distribution needs to be invalidated.
  
          :param requirement: A :class:`.Requirement` object.
          :param cache_file: The pathname of a cached binary distribution (a string).
          :returns: :data:`True` if the cached binary distribution needs to be
                    invalidated, :data:`False` otherwise.