def _save_data(filename, data): """ Save formatted skeleton data to a pickle file """ if filename[-2:] == ".p": filename = filename else: filename = str(filename + ".p") with open(filename, 'wb') as fp: pickle.dump(data, fp, protocol=pickle.HIGHEST_PROTOCOL) print("Saved data to file: " + filename)