code: def _set_language(pdf: Pdf, languages: list[str]):
      """Set the language of the PDF."""
      if Name.Lang in pdf.Root or not languages:
          return  # Already set or can't change
      primary_language_iso639_3 = languages[0]
      if not primary_language_iso639_3:
          return
      iso639_2 = iso_639_2_from_3(primary_language_iso639_3)
      if not iso639_2:
          return
      pdf.Root.Lang = iso639_2
  
imports: from __future__ import annotations
  import logging
  import os
  from datetime import datetime, timezone
  from pathlib import Path
  from typing import Any
  from pikepdf import Dictionary, Name, Pdf
  from pikepdf import __version__
  from pikepdf.models.metadata import PdfMetadata, encode_pdf_date
  from ocrmypdf._jobcontext import PdfContext
  from ocrmypdf._version import PROGRAM_NAME
  from ocrmypdf._version import __version__
  from ocrmypdf.languages import iso_639_2_from_3
label_desc: Use image node_id 7 for calling a global function with example usage: _set_language(pdf, languages) without return types