code: def _validated_dir(path):
      path = os.path.expanduser(path)
      if not os.path.exists(path):
          cli.error(f"directory '{path}' does not exist")
      if not os.path.isdir(path):
          cli.error(f"'{path}' is not a directory")
      return path
  
imports: import logging
  import os
  from guild import cli
  from guild import config
  from guild import log
label_desc: Use image node_id 11 for calling a global function with example usage: _validated_dir(path) and returns: path