code: def site_directory_contains_stale_files(site_directory: str) -> bool:
      """Check if the site directory contains stale files from a previous build."""
      return bool(
          os.path.exists(site_directory) and os.listdir(site_directory)
      )
  
imports: from __future__ import annotations
  import gzip
  import logging
  import os
  import time
  from typing import TYPE_CHECKING, Sequence
  from urllib.parse import urljoin, urlsplit
  import jinja2
  from jinja2.exceptions import TemplateNotFound
  import mkdocs
  from mkdocs import utils
  from mkdocs.exceptions import Abort, BuildError
  from mkdocs.structure.files import File, Files, InclusionLevel, get_files, set_exclusions
  from mkdocs.structure.nav import Navigation, get_navigation
  from mkdocs.structure.pages import Page
  from mkdocs.utils import DuplicateFilter
  from mkdocs.utils import templates
label_desc: Use image node_id 8 for calling a global function with example usage: site_directory_contains_stale_files(site_directory) and returns: bool