code: def _populate_page(
      page: Page,
      config: MkDocsConfig,
      files: Files,
      dirty: bool = False,
  ) -> None:
      """Read page content from docs_dir and render Markdown."""
      config._current_page = page
      try:
          # When --dirty is used, only read the page if the file has been modified since the
          # previous build of the output.
          if dirty and not page.file.is_modified():
              return
  
          # Run the `pre_page` plugin event
          page = config.plugins.on_pre_page(
              page, config=config, files=files
          )
  
          page.read_source(config)
          assert page.markdown is not None
  
          # Run `page_markdown` plugin events.
          page.markdown = config.plugins.on_page_markdown(
              page.markdown, page=page, config=config, files=files
          )
  
          page.render(config, files)
          assert page.content is not None
  
          # Run `page_content` plugin events.
          page.content = config.plugins.on_page_content(
              page.content, page=page, config=config, files=files
          )
      except Exception as e:
          message = f"Error reading page '{page.file.src_uri}':"
          # Prevent duplicated the error message because it will be printed immediately afterwards.
          if not isinstance(e, BuildError):
              message += f" {e}"
          log.error(message)
          raise
      finally:
          config._current_page = None
  
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 5 for calling a global function with example usage: _populate_page(page, config, files, dirty) without return types