code: def search_function(encoding):
      """
      Register our "bad codecs" with Python's codecs API. This involves adding
      a search function that takes in an encoding name, and returns a codec
      for that encoding if it knows one, or None if it doesn't.
  
      The encodings this will match are:
  
      - Encodings of the form 'sloppy-windows-NNNN' or 'sloppy-iso-8859-N',
        where the non-sloppy version is an encoding that leaves some bytes
        unmapped to characters.
      - The 'utf-8-variants' encoding, which has the several aliases seen
        above.
      """
      if encoding in _CACHE:
          return _CACHE[encoding]
  
      norm_encoding = normalize_encoding(encoding)
      codec = None
      if norm_encoding in UTF8_VAR_NAMES:
          from ftfy.bad_codecs.utf8_variants import CODEC_INFO
  
          codec = CODEC_INFO
      elif norm_encoding.startswith("sloppy_"):
          from ftfy.bad_codecs.sloppy import CODECS
  
          codec = CODECS.get(norm_encoding)
  
      if codec is not None:
          _CACHE[encoding] = codec
  
      return codec
  
imports: from encodings import normalize_encoding
  import codecs
  from typing import Dict
label_desc: Use image node_id 1 for calling a global function with example usage: search_function(encoding) and returns: codec, _CACHE