def mkdir_p(newdir, mode=<NUM_LIT>):
try:<EOL><INDENT>os.makedirs(newdir, mode)<EOL><DEDENT>except OSError as err:<EOL><INDENT>if err.errno != errno.EEXIST or not os.path.isdir(newdir):<EOL><INDENT>raise<EOL><DEDENT><DEDENT>
The missing mkdir -p functionality in os.