def _urlopen_cached(url, cache):
 from_cache = False
 if (cache is not None):
  cache_path = join(cache, (url.split('://')[(-1)].replace('/', ',') + '.zip'))
  try:
   data = _open_cache(cache_path)
   from_cache = True
  except:
   pass
 if (not from_cache):
  data = urlopen(url).read()
  if (cache is not None):
   _cache_it(data, cache_path)
 return (data, from_cache)

def _urlopen_cached ( url , cache ) : from_cache = False if ( cache is not None ) : cache_path = join ( cache , ( url . split ( '://' ) [ ( - 1 ) ] . replace ( '/' , ',' ) + '.zip' ) ) try : data = _open_cache ( cache_path ) from_cache = True except : pass if ( not from_cache ) : data = urlopen ( url ) . read ( ) if ( cache is not None ) : _cache_it ( data , cache_path ) return ( data , from_cache )
tries to load data from cache location otherwise downloads it .