def download_data(dataset_name=None):
try:<EOL><INDENT>from itertools import zip_longest<EOL><DEDENT>except ImportError:<EOL><INDENT>from itertools import izip_longest as zip_longest<EOL><DEDENT>dr = data_resources[dataset_name]<EOL>if not authorize_download(dataset_name):<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>zip_urls = (dr['<STR_LIT>'], dr['<STR_LIT>'])<EOL>if '<STR_LIT>' in dr: zip_urls += (dr['<STR_LIT>'], )<EOL>else: zip_urls += ([],)<EOL>if '<STR_LIT>' in dr: zip_urls += (dr['<STR_LIT>'], )<EOL>else: zip_urls += ([],)<EOL>for url, files, save_names, suffices in zip_longest(*zip_urls, fillvalue=[]):<EOL><INDENT>for f, save_name, suffix in zip_longest(files, save_names, suffices, fillvalue=None):<EOL><INDENT>download_url(os.path.join(url,f), dataset_name, save_name, suffix=suffix)<EOL><DEDENT><DEDENT>return True<EOL>
Check with the user that the are happy with terms and conditions for the data set, then download it.