def makedirs(name, mode=<NUM_LIT>):
head, tail = path.split(name)<EOL>if not tail:<EOL><INDENT>head, tail = path.split(head)<EOL><DEDENT>if head and tail and not path.exists(head):<EOL><INDENT>try:<EOL><INDENT>makedirs(head, mode)<EOL><DEDENT>except OSError as e:<EOL><INDENT>if e.errno != errno.EEXIST:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>if tail == curdir:           <EOL><INDENT>return<EOL><DEDENT><DEDENT>mkdir(name, mode)<EOL>
makedirs(path [, mode=0777])

    Super-mkdir; create a leaf directory and all intermediate ones.
    Works like mkdir, except that any intermediate path segment (not
    just the rightmost) will be created if it does not exist.  This is
    recursive.