#NEWLINE# def _download_file( url , out_fp , decompress = True , chunk_size = CHUNK_SIZE , on_chunk = ( lambda : None ) ) : #NEWLINE# #INDENT# decompressor = bz2 . BZ2Decompressor ( ) #NEWLINE# fp = urlopen ( url , timeout = 30 ) #NEWLINE# while 1 : #NEWLINE# #INDENT# data = fp . read ( chunk_size ) #NEWLINE# if ( not data ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if decompress : #NEWLINE# #INDENT# out_fp . write ( decompressor . decompress ( data ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# out_fp . write ( chunk_size ) #NEWLINE# #UNINDENT# on_chunk ( )