<s> import os <EOL> import shutil <EOL> import urllib . request <EOL> def download ( url , local_path ) : <EOL> """<STR_LIT>""" <EOL> tmp_data_set_path = local_path + "<STR_LIT>" <EOL> try : <EOL> with urllib . request . urlopen ( url ) as response , open ( tmp_data_set_path , "<STR_LIT:wb>" ) as out_file : <EOL> shutil . copyfileobj ( response , out_file ) <EOL> except : <EOL> if os . path . isfile ( tmp_data_set_path ) : <EOL> os . remove ( tmp_data_set_path ) <EOL> raise <EOL> else : <EOL> os . rename ( tmp_data_set_path , local_path ) </s>
