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 Exception('<STR_LIT>' % path)<EOL><DEDENT><DEDENT>
Make directories recursively.

    :param path: path to create
    :type path: str