import pickle
import os


def save_to_file(data, save_dir, filename):
    if not os.path.exists(save_dir):
        os.makedirs(save_dir)
    with open(os.path.join(save_dir, filename), "wb") as f:
        pickle.dump(data, f)
