sysTemp = tempfile.gettempdir()
myTemp = os.path.join(sysTemp, 'mytemp')
if not os.path.exists(myTemp):
    os.makedirs(myTemp)
tempdir = tempfile.mkdtemp(suffix='foo', prefix='bar', dir=myTemp)
print(tempdir)
Using tempfile to create a sub-directory for all of my tempfiles