code: def convert_image_processor(proc: dict):
      flat = []
  
      def recurse_convert(p: dict):
          t = p.get("type", "DEFAULT_NORMALIZER")
          if t == "DEFAULT_NORMALIZER":
              flat.extend(default_data_normalizer())
          elif t == "MULTI_NORMALIZER":
              for c in p["children"]:
                  recurse_convert(c)
          elif t == "NOOP_NORMALIZER":
              pass
          elif t == "RANGE_NORMALIZER":
              flat.append(image_processor("DataRangeNormalizer"))
          elif t == "CENTER_NORMALIZER":
              flat.append(image_processor("CenterNormalizer"))
          elif t == "FINAL_PREPARATION":
              flat.append(
                  image_processor(
                      "FinalPreparation",
                      args={
                          "normalize": not p.get("noNormalize", False),
                          "invert": not p.get("noInvert", False),
                          "transpose": not p.get("noTranspose", False),
                          "pad": p.get("pad", 0),
                          "pad_value": p.get("padValue", 0),
                          "as_uint8": True,
                      },
                  )
              )
          elif t == "SCALE_TO_HEIGHT":
              flat.append(image_processor("ScaleToHeightProcessor"))
          else:
              raise ValueError(f"Unknown type {t}")
  
      recurse_convert(proc)
      return flat
  
imports: import inspect
  import os
  from typing import Optional
  import logging
  import h5py
  from tensorflow import keras
  from tensorflow.python.keras.saving.hdf5_format import load_weights_from_hdf5_group
  from tfaip.util.tfaipargparse import post_init
  from calamari_ocr.ocr.savedmodel.migrations.version3_4to5 import migrate3to5
  from calamari_ocr.ocr.scenario import CalamariScenario
  from calamari_ocr.ocr.training.params import TrainerParams
label_desc: Use image node_id 4 for calling a global function with example usage: convert_image_processor(proc) and returns: flat