#NEWLINE# def ensure_tree( path ) : #NEWLINE# #INDENT# 'Create a directory (and any ancestor directories required)\n\n    :param path: Directory to create\n    ' #NEWLINE# try : #NEWLINE# #INDENT# os . makedirs ( path ) #NEWLINE# #UNINDENT# except OSError as exc : #NEWLINE# #INDENT# if ( exc . errno == errno . EEXIST ) : #NEWLINE# #INDENT# if ( not os . path . isdir ( path ) ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise