code: def check_auto_ext(fmt, metadata, option):
      """Replace the auto extension with the actual file extension, and raise a ValueError if it cannot be determined"""
      if fmt["extension"] != ".auto":
          return fmt
  
      auto_ext = auto_ext_from_metadata(metadata)
      if auto_ext:
          fmt = fmt.copy()
          fmt["extension"] = auto_ext
          return fmt
  
      raise ValueError(
          "The notebook does not have a 'language_info' metadata. "
          "Please replace 'auto' with the actual language extension in the {} option (currently {}).".format(
              option, short_form_one_format(fmt)
          )
      )
  
imports: import os
  import re
  import warnings
  import nbformat
  import yaml
  from .cell_reader import DoublePercentScriptCellReader, HydrogenCellReader, LightScriptCellReader, MarkdownCellReader, RMarkdownCellReader, RScriptCellReader, SphinxGalleryScriptCellReader
  from .cell_to_text import BareScriptCellExporter, DoublePercentCellExporter, HydrogenCellExporter, LightScriptCellExporter, MarkdownCellExporter, RMarkdownCellExporter, RScriptCellExporter, SphinxGalleryCellExporter
  from .header import header_to_metadata_and_cell, insert_or_test_version_number
  from .languages import _COMMENT_CHARS, _SCRIPT_EXTENSIONS, same_language
  from .magics import is_magic
  from .metadata_filter import metadata_filter_as_string
  from .myst import MYST_FORMAT_NAME, is_myst_available, matches_mystnb, myst_extensions, myst_version
  from .pandoc import is_pandoc_available, pandoc_version
  from .stringparser import StringParser
  from .version import __version__
label_desc: Use image node_id 17 for calling a global function with example usage: check_auto_ext(fmt, metadata, option) and returns: fmt, fmt