@yarikoptic actually the tempfile.mktemp documentation says: "If dir is specified, the file will be created in that directory; otherwise, a default directory is used. ". 

Do you want to override it to support dir=True, meaning that a directory is returned?