def stream_response(self, response, stream_to=None, show_progress=True):
if response.status_code == <NUM_LIT:200>:<EOL><INDENT>if show_progress is False:<EOL><INDENT>bot.quiet = True<EOL><DEDENT>content_size = None<EOL>if '<STR_LIT>' in response.headers:<EOL><INDENT>progress = <NUM_LIT:0><EOL>content_size = int(response.headers['<STR_LIT>'])<EOL>bot.show_progress(progress, content_size, length=<NUM_LIT>)<EOL><DEDENT>chunk_size = <NUM_LIT:1> << <NUM_LIT:20><EOL>with open(stream_to, '<STR_LIT:wb>') as filey:<EOL><INDENT>for chunk in response.iter_content(chunk_size=chunk_size):<EOL><INDENT>filey.write(chunk)<EOL>if content_size is not None:<EOL><INDENT>progress+=chunk_size<EOL>bot.show_progress(iteration=progress,<EOL>total=content_size,<EOL>length=<NUM_LIT>,<EOL>carriage_return=False)<EOL><DEDENT><DEDENT><DEDENT>sys.stdout.write('<STR_LIT:\n>')<EOL>return stream_to <EOL><DEDENT>bot.error("<STR_LIT>" %(response.status_code))<EOL>sys.exit(<NUM_LIT:1>)<EOL>
stream response is one level higher up than stream, starting with a 
response object and then performing the stream without making the
requests.get. The expectation is that the request was successful 
(status code 20*).
show_progress: boolean to show progress bar

Parameters
==========
response: a response that is ready to be iterated over to download in
          streamed chunks
stream_to: the file to stream to