code: def _build_extra_template(
      template_name: str,
      files: Files,
      config: MkDocsConfig,
      nav: Navigation,
  ):
      """Build user templates which are not part of the theme."""
      log.debug(f"Building extra template: {template_name}")
  
      file = files.get_file_from_path(template_name)
      if file is None:
          log.warning(
              f"Template skipped: '{template_name}' not found in docs_dir."
          )
          return
  
      try:
          with open(
              file.abs_src_path, encoding="utf-8", errors="strict"
          ) as f:
              template = jinja2.Template(f.read())
      except Exception as e:
          log.warning(f"Error reading template '{template_name}': {e}")
          return
  
      output = _build_template(
          template_name, template, files, config, nav
      )
  
      if output.strip():
          utils.write_file(output.encode("utf-8"), file.abs_dest_path)
      else:
          log.info(
              f"Template skipped: '{template_name}' generated empty output."
          )
  
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 4 for calling a global function with example usage: _build_extra_template(template_name, files, config, nav) without return types