def dump_pickle(data, path_to_file): try: with open(path_to_file, 'w') as f: pickle.dump(data, f) except Exception as e: raise e