code: def check_file_version(notebook, source_path, outputs_path):
      """Raise if file version in source file would override outputs"""
      if not insert_or_test_version_number():
          return
  
      _, ext = os.path.splitext(source_path)
      assert not ext.endswith(
          ".ipynb"
      ), "source_path={} should be a text file".format(source_path)
  
      version = (
          notebook.metadata.get("jupytext", {})
          .get("text_representation", {})
          .get("format_version")
      )
      format_name = format_name_for_ext(notebook.metadata, ext)
  
      fmt = get_format_implementation(ext, format_name)
      current = fmt.current_version_number
  
      # Missing version, still generated by jupytext?
      if notebook.metadata and not version:
          version = current
  
      # Same version? OK
      if version == fmt.current_version_number:
          return
  
      # Version larger than minimum readable version
      if (
          (fmt.min_readable_version_number or current)
          <= version
          <= current
      ):
          return
  
      jupytext_version_in_file = (
          notebook.metadata.get("jupytext", {})
          .get("text_representation", {})
          .get("jupytext_version", "N/A")
      )
  
      raise JupytextFormatError(
          "The file {source_path} was generated with jupytext version {jupytext_version_in_file} "
          "but you have {jupytext_version} installed. Please upgrade jupytext to version "
          "{jupytext_version_in_file}, or remove either {source_path} or {output_path}. "
          "This error occurs because {source_path} is in the {format_name} format in version {format_version}, "
          "while jupytext version {jupytext_version} installed at {jupytext_path} can only read the "
          "{format_name} format in versions {min_format_version} to {current_format_version}.".format(
              source_path=os.path.basename(source_path),
              output_path=os.path.basename(outputs_path),
              format_name=format_name,
              format_version=version,
              jupytext_version_in_file=jupytext_version_in_file,
              jupytext_version=__version__,
              jupytext_path=os.path.dirname(os.path.dirname(__file__)),
              min_format_version=fmt.min_readable_version_number
              or current,
              current_format_version=current,
          )
      )
  
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 6 for calling a global function with example usage: check_file_version(notebook, source_path, outputs_path) without return types