@contextmanager<EOL>def mkdir_temp(mode=<NUM_LIT>):
temp_dir = None<EOL>try:<EOL><INDENT>temp_dir = tempfile.mkdtemp()<EOL>os.chmod(temp_dir, mode)<EOL>yield temp_dir<EOL><DEDENT>finally:<EOL><INDENT>if temp_dir:<EOL><INDENT>shutil.rmtree(temp_dir)<EOL><DEDENT><DEDENT>
Context manager that makes a temporary directory and yields it name. Directory is deleted
after the context exits

Parameters
----------
mode : octal
    Permissions to apply to the directory. Defaults to '755' because don't want directories world writable

Returns
-------
str
    Path to the directory