docs: def check_instance_folder(self, create=False):
          """Verify instance folder exists, is a directory, and has necessary
          permissions.
  
          :param:create: if `True`, creates directory hierarchy
  
          :raises: OSError with relevant errno if something is wrong.
          """
          path = Path(self.instance_path)
          err = None
          eno = 0
  
          if not path.exists():
              if create:
                  logger.info("Create instance folder: %s", path)
                  path.mkdir(0o775, parents=True)
              else:
                  err = "Instance folder does not exists"
                  eno = errno.ENOENT
          elif not path.is_dir():
              err = "Instance folder is not a directory"
              eno = errno.ENOTDIR
          elif not os.access(str(path), os.R_OK | os.W_OK | os.X_OK):
              err = 'Require "rwx" access rights, please verify permissions'
              eno = errno.EPERM
  
          if err:
              raise OSError(eno, err, str(path))