Additional comments
Remove unnecessary tmp_dir name check

os.path.join('/', 'foo', '/') returns '/', which makes me somewhat terrified to
use it before a shutil.rmtree(), but ending with a regular basename should be
safe.
Rename variable