I have created a function called createDirAndFile for creating a directory and filename and saving a function using dill.
dill