import pickle


def pickle_data(data, pathToPickleFile):
    """
    Pickle data to the specified file.
    Example use: pickle_data(ground_truth_dict, os.path.join(output_dir, 'ground_truth.pkl'))
    :param data: variable / data structure to pickle, e.g. myDict
    :param pathToPickleFile: file for pickling, e.g. 'dataset.pkl')
    :return:
    """
    with open(pathToPickleFile, 'wb') as pickle_file:
        pickle.dump(data, pickle_file)
    print("pickled data at " + pathToPickleFile)
    return True