def download_file(url, dest):
<EOL>request = urllib2.Request(url)<EOL>request.add_header('<STR_LIT>', '<STR_LIT>')<EOL>opener = urllib2.build_opener()<EOL>response = opener.open(request)<EOL>data = response.read()<EOL>if response.headers.get('<STR_LIT>', '<STR_LIT>') == '<STR_LIT>':<EOL><INDENT>stream = StringIO.StringIO(data)<EOL>gzipper = gzip.GzipFile(fileobj=stream)<EOL>data = gzipper.read()<EOL><DEDENT>f = open(dest, '<STR_LIT:wb>')<EOL>f.write(data)<EOL>f.close()<EOL>
Downloads a HTTP resource from `url` and save to `dest`.

Capable of dealing with Gzip compressed content.