@contextlib.contextmanager<EOL>def temp_umask(umask):
oldmask = os.umask(umask)<EOL>try:<EOL><INDENT>yield<EOL><DEDENT>finally:<EOL><INDENT>os.umask(oldmask)<EOL><DEDENT>
Context manager that temporarily sets the process umask.