from pathlib import Path
import pickle


def my_piclke_dump(var, file_name):
    """
    This function saves 'var' in a pickle file with the name 'file_name'.
    We use the folder 'Pickles' to save all the pickles.
    Example:

    file_name = "test"
    x = 4
    var = x
    my_piclke_dump(var, file_name)

    :param var: variable to save
    :param file_name: file name
    :return: True
    """
    file_path = Path().joinpath('Pickles', file_name + ".pkl")
    pickle_out = open(file_path, "wb")
    pickle.dump(var, pickle_out)
    pickle_out.close()
    print("The file ", file_path, "was save.")
    return(True)