'Determines if the cache files have expired, or if it is still valid'

def is_cache_valid(self):

    if self.args.debug:
        print(('Determining    if    cache    [%s]    is    still    valid    (<    %s    seconds    old)' % (self.cache_path_hosts, self.cache_max_age)))
    if os.path.isfile(self.cache_path_hosts):
        mod_time = os.path.getmtime(self.cache_path_hosts)
        current_time = time()
        if ((mod_time + self.cache_max_age) > current_time):
            if os.path.isfile(self.cache_path_inventory):
                if self.args.debug:
                    print('Cache    is    still    valid!')
                return True
    if self.args.debug:
        print('Cache    is    stale    or    does    not    exist.')
    return False
