def is_cache_stale(cache_file, cache_expiration_time, refresh=False):
 if refresh:
  return True
 if (os.path.isfile(cache_file) and (os.path.getsize(cache_file) > 0)):
  mod_time = os.path.getmtime(cache_file)
  current_time = time.time()
  if ((mod_time + cache_expiration_time) > current_time):
   return False
 return True

def is_cache_stale ( cache_file , cache_expiration_time , refresh = False ) : if refresh : return True if ( os . path . isfile ( cache_file ) and ( os . path . getsize ( cache_file ) > 0 ) ) : mod_time = os . path . getmtime ( cache_file ) current_time = time . time ( ) if ( ( mod_time + cache_expiration_time ) > current_time ) : return False return True
determines if cache file has expired .