def decompress(fileobj, path):
 if path.endswith('.gz'):
  return gunzip_stream(fileobj)
 elif path.endswith('.bz2'):
  if (bz2 is None):
   raise Exception('bz2 module was not successfully imported (likely not installed).')
  else:
   return bunzip2_stream(fileobj)
 else:
  return fileobj

def decompress ( fileobj , path ) : if path . endswith ( '.gz' ) : return gunzip_stream ( fileobj ) elif path . endswith ( '.bz2' ) : if ( bz2 is None ) : raise Exception ( 'bz2 module was not successfully imported (likely not installed).' ) else : return bunzip2_stream ( fileobj ) else : return fileobj
decompress a gzip compressed string in one shot .