#NEWLINE# def gunzip( data ) : #NEWLINE# #INDENT# 'Gunzip the given data and return as much data as possible.\n\n    This is resilient to CRC checksum errors.\n    ' #NEWLINE# f = GzipFile ( fileobj = BytesIO ( data ) ) #NEWLINE# output = b'' #NEWLINE# chunk = b'.' #NEWLINE# while chunk : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# chunk = read1 ( f , 8196 ) #NEWLINE# output += chunk #NEWLINE# #UNINDENT# except ( IOError , EOFError , struct . error ) : #NEWLINE# #INDENT# if ( output or getattr ( chunk , 'extrabuf' , None ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# output += f . extrabuf #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return output