#NEWLINE# def ensure_dir_notexists( path ) : #NEWLINE# #INDENT# '\n    helper function, removes dir if it exists\n\n    :returns: True if dir does not exist after this function\n    :raises: OSError if dir exists and removal failed for non-trivial reasons\n    ' #NEWLINE# try : #NEWLINE# #INDENT# if os . path . exists ( path ) : #NEWLINE# #INDENT# os . rmdir ( path ) #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# except OSError as ose : #NEWLINE# #INDENT# if ( ose . errno not in [ errno . ENOENT , errno . ENOTEMPTY , errno . ENOTDIR ] ) : #NEWLINE# #INDENT# return False