code: def mkdir(path, parents=False):
      
      func = os.makedirs if parents else os.mkdir
      try:
          return func(path)
      except:
          if not parents:
              raise
docs: parents: no error if existing, make parent directories as needed