code: def set_default_download_dir(path):
      if isinstance(path, str):
          path = Path(path)
      elif not isinstance(path, Path):
          raise ValueError(
              "`path` must be a string or a pathlib.Path object"
          )
  
      if not os.access(str(path), os.W_OK):
          raise ValueError(
              "The specified download directory {} is not writable".format(
                  path
              )
          )
  
      global _default_texar_download_dir  # pylint: disable=global-statement
      _default_texar_download_dir = path
  
imports: import os
  import sys
  from abc import ABCMeta, abstractmethod
  from pathlib import Path
  from texar.tf.data.data_utils import maybe_download
  from texar.tf.hyperparams import HParams
  from texar.tf.module_base import ModuleBase
label_desc: Use image node_id 2 for calling a global function with example usage: set_default_download_dir(path) without return types