def _download_py2(link, path, __hdr__):
try:<EOL><INDENT>req = urllib2.Request(link, headers=__hdr__)<EOL>u = urllib2.urlopen(req)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise Exception('<STR_LIT>'.format(e))<EOL><DEDENT>with open(path, '<STR_LIT:wb>') as outf:<EOL><INDENT>for l in u:<EOL><INDENT>outf.write(l)<EOL><DEDENT><DEDENT>u.close()<EOL>
Download a file from a link in Python 2.