def save_object(filename, obj):
 logging.info('saving {}...'.format(filename))
 try:
  with gzip.GzipFile(filename, 'wb') as f:
   f.write(pickle.dumps(obj, 1))
 except Exception as e:
  logging.error('save failure: {}'.format(e))
  raise

def save_object ( filename , obj ) : logging . info ( 'saving {}...' . format ( filename ) ) try : with gzip . GzipFile ( filename , 'wb' ) as f : f . write ( pickle . dumps ( obj , 1 ) ) except Exception as e : logging . error ( 'save failure: {}' . format ( e ) ) raise
compresses and pickles given object to the given filename .