code: def get_orientation(
      input_file: Path, engine_mode: int | None, timeout: float
  ) -> OrientationConfidence:
      args_tesseract = tess_base_args(["osd"], engine_mode) + [
          "--psm",
          "0",
          fspath(input_file),
          "stdout",
      ]
  
      try:
          p = run(
              args_tesseract,
              stdout=PIPE,
              stderr=STDOUT,
              timeout=timeout,
              check=True,
          )
      except TimeoutExpired:
          return OrientationConfidence(angle=0, confidence=0.0)
      except CalledProcessError as e:
          tesseract_log_output(e.stdout)
          tesseract_log_output(e.stderr)
          if (
              b"Too few characters. Skipping this page" in e.output
              or b"Image too large" in e.output
          ):
              return OrientationConfidence(0, 0)
          raise SubprocessOutputError() from e
  
      osd = _parse_tesseract_output(p.stdout)
      angle = int(osd.get("Orientation in degrees", 0))
      orient_conf = OrientationConfidence(
          angle=angle,
          confidence=float(osd.get("Orientation confidence", 0)),
      )
      return orient_conf
  
imports: from __future__ import annotations
  import logging
  import re
  from contextlib import suppress
  from math import pi
  from os import fspath
  from pathlib import Path
  from subprocess import PIPE, STDOUT, CalledProcessError, TimeoutExpired
  from packaging.version import Version
  from ocrmypdf.exceptions import MissingDependencyError, SubprocessOutputError, TesseractConfigError
  from ocrmypdf.pluginspec import OrientationConfidence
  from ocrmypdf.subprocess import get_version, run
label_desc: Use image node_id 6 for calling a global function with example usage: get_orientation(input_file, engine_mode, timeout) and returns: orient_conf, OrientationConfidence, OrientationConfidence