code: func EnsureLocalPath(customPath string, defaultLocalDir, defaultLocalPath string) (string, error) {
  	if customPath == "" {
  		homeDir := getHomeDir()
  		if homeDir == "" {
  			return "", trace.BadParameter("no path provided and environment variable %v is not not set", teleport.EnvHome)
  		}
  		customPath = filepath.Join(homeDir, defaultLocalDir, defaultLocalPath)
  	}
  	baseDir := filepath.Dir(customPath)
  	_, err := StatDir(baseDir)
  	if err != nil {
  		if trace.IsNotFound(err) {
  			if err := MkdirAll(baseDir, teleport.PrivateDirMode); err != nil {
  				return "", trace.Wrap(err)
  			}
  		} else {
  			return "", trace.Wrap(err)
  		}
  	}
  	return customPath, nil
  }
docs: // EnsureLocalPath makes sure the path exists, or, if omitted results in the subpath in
  // default gravity config directory, e.g.
  //
  // EnsureLocalPath("/custom/myconfig", ".gravity", "config") -> /custom/myconfig
  // EnsureLocalPath("", ".gravity", "config") -> ${HOME}/.gravity/config
  //
  // It also makes sure that base dir exists