def download_file(url, path=None, clobber=False):
if path is None:<EOL><INDENT>local_filename = os.path.join(directory, url.split('<STR_LIT:/>')[-<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>local_filename = path<EOL><DEDENT>if os.path.exists(local_filename) and not clobber:<EOL><INDENT>logging.info('<STR_LIT>'.format(local_filename))<EOL>return local_filename<EOL><DEDENT>r = requests.get(url, stream=True)<EOL>with open(local_filename, '<STR_LIT:wb>') as f:<EOL><INDENT>for chunk in r.iter_content(chunk_size=<NUM_LIT>):<EOL><INDENT>if chunk: <EOL><INDENT>f.write(chunk)<EOL><DEDENT><DEDENT><DEDENT>return local_filename<EOL>
thanks to: https://stackoverflow.com/questions/16694907/how-to-download-large-file-in-python-with-requests-py

path : str
    local path to download to.