def read_zfile(file_handle):
 file_handle.seek(0)
 header_length = (len(_ZFILE_PREFIX) + _MAX_LEN)
 length = file_handle.read(header_length)
 length = length[len(_ZFILE_PREFIX):]
 length = int(length, 16)
 next_byte = file_handle.read(1)
 if (next_byte != ' '):
  file_handle.seek(header_length)
 data = zlib.decompress(file_handle.read(), 15, length)
 assert (len(data) == length), ('Incorrect data length while decompressing %s.The file could be corrupted.' % file_handle)
 return data

def read_zfile ( file_handle ) : file_handle . seek ( 0 ) header_length = ( len ( _ZFILE_PREFIX ) + _MAX_LEN ) length = file_handle . read ( header_length ) length = length [ len ( _ZFILE_PREFIX ) : ] length = int ( length , 16 ) next_byte = file_handle . read ( 1 ) if ( next_byte != ' ' ) : file_handle . seek ( header_length ) data = zlib . decompress ( file_handle . read ( ) , 15 , length ) assert ( len ( data ) == length ) , ( 'Incorrect data length while decompressing %s.The file could be corrupted.' % file_handle ) return data
read the z-file and return the content as a string .