def save_episode(episode_path, episode): with gzip.open(episode_path, "wb") as f: pickler = pickle.Pickler(f) pickler.dump(episode)