import pickle


def get_temp_data(filename, directory='temp', extension='.temp'):
    """get temp data from disk"""
    
    if '.temp' not in filename:
        filename += extension
    try:
        with open(directory + '/'+ filename, 'rb') as f:
            data_file = pickle.load(f)
            f.close()
        print("Data loaded from {} in working directory".format(filename))
        return data_file
    except FileNotFoundError as err:
        print("\nNo file was found at following path: '{}'. Exiting...\n".format(err.filename))
        exit(1)