'Does the cache have a valid entry for `mod_path`.'

def cache_has_valid_entry(self, mod_path, distribution=None):

    mod_path = fix_pyext(mod_path)
    if (not os.path.exists(mod_path)):
        return False
    if (mod_path in self.cached_descriptions):
        entry = self.cache_get(mod_path)
        mtime = os.stat(mod_path).st_mtime
        if (entry.mtime != mtime):
            return False
        if (distribution is not None):
            if ((entry.project_name != distribution.project_name) or (entry.project_version != distribution.version)):
                return False
        if (entry.exc_type == WidgetSpecificationError):
            return False
        return True
    return False
