def download_url(url, filename, headers):
ensure_dirs(filename)<EOL>response = requests.get(url, headers=headers, stream=True)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>with open(filename, "<STR_LIT:wb>") as fp:<EOL><INDENT>for chunk in response.iter_content(<NUM_LIT:16> * <NUM_LIT>):<EOL><INDENT>fp.write(chunk)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>print(("<STR_LIT>".format(url, response)))<EOL><DEDENT>
Download a file from ``url`` to ``filename``.