def mkdir_p(path):
try:<EOL><INDENT>os.makedirs(path)<EOL><DEDENT>except OSError as exc:<EOL><INDENT>if exc.errno != errno.EEXIST:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>
NOOP if the directory exists. If not, it creates the whole directory tree.