code: def _is_valid_path(path: Optional[str]) -> bool:
      return isinstance(path, str) and (
          os.path.isfile(path) or os.path.isdir(path)
      )
  
imports: import collections
  import os
  import sys
  import types
  from typing import Callable, Dict, List, Optional, Set
  from streamlit import config, file_util
  from streamlit.folder_black_list import FolderBlackList
  from streamlit.logger import get_logger
  from streamlit.source_util import get_pages
  from streamlit.watcher.path_watcher import NoOpPathWatcher, get_default_path_watcher_class
label_desc: Use image node_id 2 for calling a global function with example usage: _is_valid_path(path) and returns: unknown