code: def update_jupytext_formats_metadata(metadata, new_format):
      """Update the jupytext_format metadata in the Jupyter notebook"""
      new_format = long_form_one_format(new_format)
      formats = long_form_multiple_formats(
          metadata.get("jupytext", {}).get("formats", "")
      )
      if not formats:
          return
  
      for fmt in formats:
          if identical_format_path(fmt, new_format):
              fmt["format_name"] = new_format.get("format_name")
              break
  
      metadata.setdefault("jupytext", {})[
          "formats"
      ] = short_form_multiple_formats(formats)
  
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 9 for calling a global function with example usage: update_jupytext_formats_metadata(metadata, new_format) without return types