<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def needs_invalidation(self, requirement, cache_file):
 """ 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. """

        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