def mkdir_p(path):
try:<EOL><INDENT>os.makedirs(path)<EOL><DEDENT>except OSError as exc:<EOL><INDENT>if exc.errno == errno.EEXIST and os.path.isdir(path):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>
like `mkdir -p`