code: def load_paired_notebook(
      notebook, fmt, config, formats, nb_file, log, pre_commit_mode
  ):
      """Update the notebook with the inputs and outputs of the most recent paired files"""
      if not formats:
          raise NotAPairedNotebook(
              f"{shlex.quote(nb_file)} is not a paired notebook"
          )
  
      formats = long_form_multiple_formats(formats)
      _, fmt_with_prefix_suffix = find_base_path_and_format(
          nb_file, formats
      )
      fmt.update(fmt_with_prefix_suffix)
  
      def read_one_file(path, fmt):
          if path == nb_file:
              return notebook
  
          log(f"[jupytext] Loading {shlex.quote(path)}")
          return read(path, fmt=fmt, config=config)
  
      if pre_commit_mode and file_in_git_index(nb_file):
          # We raise an error if two representations of this notebook in the git index are inconsistent
          nb_files_in_git_index = sorted(
              (
                  (alt_path, alt_fmt)
                  for alt_path, alt_fmt in paired_paths(
                      nb_file, fmt, formats
                  )
                  if file_in_git_index(alt_path)
              ),
              key=lambda x: 0 if x[1]["extension"] != ".ipynb" else 1,
          )
  
          if len(nb_files_in_git_index) > 1:
              path0, fmt0 = nb_files_in_git_index[0]
              with open(path0, encoding="utf-8") as fp:
                  text0 = fp.read()
              for alt_path, alt_fmt in nb_files_in_git_index[1:]:
                  nb = read(alt_path, fmt=alt_fmt, config=config)
                  alt_text = writes(nb, fmt=fmt0, config=config)
                  if alt_text != text0:
                      diff = compare(
                          alt_text,
                          text0,
                          alt_path,
                          path0,
                          return_diff=True,
                      )
                      raise InconsistentVersions(
                          f"{shlex.quote(alt_path)} and {shlex.quote(path0)} are inconsistent.\n"
                          + diff
                          + f"\nPlease revert JUST ONE of the files with EITHER\n"
                          f"    git reset {shlex.quote(alt_path)} && git checkout -- {shlex.quote(alt_path)}\nOR\n"
                          f"    git reset {shlex.quote(path0)} && git checkout -- {shlex.quote(path0)}\n"
                      )
  
      inputs, outputs = latest_inputs_and_outputs(
          nb_file,
          fmt,
          formats,
          git_timestamp if pre_commit_mode else get_timestamp,
      )
      notebook = read_pair(inputs, outputs, read_one_file)
  
      return notebook, inputs.path, outputs.path
  
imports: import argparse
  import glob
  import json
  import os
  import re
  import shlex
  import subprocess
  import sys
  import warnings
  from copy import copy
  from tempfile import NamedTemporaryFile
  from .combine import combine_inputs_with_outputs
  from .compare import NotebookDifference, compare, test_round_trip_conversion
  from .config import load_jupytext_config, notebook_formats
  from .formats import _BINARY_FORMAT_OPTIONS, _VALID_FORMAT_OPTIONS, JUPYTEXT_FORMATS, check_auto_ext, check_file_version, long_form_multiple_formats, long_form_one_format, short_form_one_format
  from .header import recursive_update
  from .jupytext import create_prefix_dir, read, reads, write, writes
  from .kernels import find_kernel_specs, get_kernel_spec, kernelspec_from_language
  from .languages import _SCRIPT_EXTENSIONS
  from .paired_paths import InconsistentPath, base_path, find_base_path_and_format, full_path, paired_paths
  from .pairs import latest_inputs_and_outputs, read_pair, write_pair
  from .version import __version__
label_desc: Use image node_id 15 for calling a global function with example usage: load_paired_notebook(notebook, fmt, config, formats, nb_file, log, pre_commit_mode) and returns: notebook,  inputs,  outputs, read, notebook