Create and return a temporary directory. This has the same behavior as mkdtemp but can be used as a context manager.
Upon exiting the context, the directory and everthing contained in it are removed.
Examples
>>> import os
>>> with TemporaryDirectory() as tmpdir:
... fname = os.path.join(tmpdir, 'example_file.txt')
... with open(fname, 'wt') as fobj:
... _ = fobj.write('a string\n')
>>> os.path.exists(tmpdir)
False