def make_dirs(path):
 try:
  os.makedirs(path)
 except OSError as ex:
  if (ex.errno != errno.EEXIST):
   raise

def make_dirs ( path ) : try : os . makedirs ( path ) except OSError as ex : if ( ex . errno != errno . EEXIST ) : raise
an idempotent version of os .