code: def search_image_for_language(
      filename: str, env: BuildEnvironment
  ) -> str:
      translated = get_image_filename_for_language(filename, env)
      _, abspath = env.relfn2path(translated)
      if path.exists(abspath):
          return translated
      else:
          return filename
  
imports: from __future__ import annotations
  import os
  import re
  from datetime import datetime, timezone
  from os import path
  from typing import TYPE_CHECKING, Callable, NamedTuple
  import babel.dates
  from babel.messages.mofile import write_mo
  from babel.messages.pofile import read_po
  from sphinx.errors import SphinxError
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.osutil import SEP, canon_path, relpath
label_desc: Use image node_id 5 for calling a global function with example usage: search_image_for_language(filename, env) and returns: translated, filename