code: def valid_dir(d: dict) -> bool:
      dir = d["path"]
      if not path.exists(dir):
          return True
      if not path.isdir(dir):
          return False
  
      if {"Makefile", "make.bat"} & set(os.listdir(dir)):
          return False
  
      if d["sep"]:
          dir = os.path.join("source", dir)
          if not path.exists(dir):
              return True
          if not path.isdir(dir):
              return False
  
      reserved_names = [
          "conf.py",
          d["dot"] + "static",
          d["dot"] + "templates",
          d["master"] + d["suffix"],
      ]
      if set(reserved_names) & set(os.listdir(dir)):
          return False
  
      return True
  
imports: from __future__ import annotations
  import argparse
  import locale
  import os
  import sys
  import time
  from os import path
  from typing import TYPE_CHECKING, Any, Callable
  from docutils.utils import column_width
  import sphinx.locale
  from sphinx import __display_version__, package_dir
  from sphinx.locale import __
  from sphinx.util.console import bold, color_terminal, colorize, nocolor, red
  from sphinx.util.osutil import ensuredir
  from sphinx.util.template import SphinxRenderer
label_desc: Use image node_id 13 for calling a global function with example usage: valid_dir(d) and returns: True, True, False, False, False, True, False