code: def _printf_s_to_format_field(printf_string, format_field):
      """Tries to replace %s with {format_field} in the provided printf_string.
      Raises ValueError in case of failure.
      """
      TEST_STRING = "PELICAN_PRINTF_S_DEPRECATION"
      expected = printf_string % TEST_STRING
  
      result = printf_string.replace("{", "{{").replace(
          "}", "}}"
      ) % "{{{}}}".format(format_field)
      if result.format(**{format_field: TEST_STRING}) != expected:
          raise ValueError(
              f"Failed to safely replace %s with {{{format_field}}}"
          )
  
      return result
  
file_path: pelican/pelican/settings.py
imports: import copy
  import importlib.util
  import inspect
  import locale
  import logging
  import os
  import re
  import sys
  from os.path import isabs
  from pathlib import Path
  from pelican.log import LimitFilter
label_desc: Use image node_id 6 for calling a global function with example usage: _printf_s_to_format_field(printf_string, format_field) and returns: result