def validate_path(confvar, is_dir=None, fs=os.path, message='Path does not exist on the filesystem.'):
  path = confvar.get()
  if path is None or not fs.exists(path):
    return [(confvar, message)]
  if is_dir is not None:
    if is_dir:
      if not fs.isdir(path):
        return [(confvar, 'Not a directory.')]
    elif not fs.isfile(path):
      return [(confvar, 'Not a file.')]
  return [ ]
Validate that the value of confvar is an existent path.
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/conf.py/validate_path