Deprecated function updated to use ScratchDir inplace of tempfile module