code: def build_preprocess_fn(
      cls, args: argparse.Namespace, train: bool
  ) -> Optional[
      Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]
  ]:
      assert check_argument_types()
      if args.use_preprocessor:
          if "st" in args.subtask_series:
              retval = MutliTokenizerCommonPreprocessor(
                  train=train,
                  token_type=[args.token_type, args.src_token_type],
                  token_list=[args.token_list, args.src_token_list],
                  bpemodel=[args.bpemodel, args.src_bpemodel],
                  non_linguistic_symbols=args.non_linguistic_symbols,
                  text_cleaner=args.cleaner,
                  g2p_type=args.g2p,
                  # NOTE(kamo): Check attribute existence for backward compatibility
                  rir_scp=getattr(args, "rir_scp", None),
                  rir_apply_prob=getattr(args, "rir_apply_prob", 1.0),
                  noise_scp=getattr(args, "noise_scp", None),
                  noise_apply_prob=getattr(
                      args, "noise_apply_prob", 1.0
                  ),
                  noise_db_range=getattr(
                      args, "noise_db_range", "13_15"
                  ),
                  short_noise_thres=getattr(
                      args, "short_noise_thres", 0.5
                  ),
                  speech_volume_normalize=getattr(
                      args, "speech_volume_normalize", None
                  ),
                  speech_name="speech",
                  text_name=["text", "src_text"],
                  **getattr(args, "preprocessor_conf", {}),
              )
          elif "diar" in args.subtask_series:
              retval = CommonPreprocessor(
                  train=train, **getattr(args, "preprocessor_conf", {})
              )
          else:
              retval = CommonPreprocessor_multi(
                  train=train,
                  token_type=args.token_type,
                  token_list=args.token_list,
                  bpemodel=args.bpemodel,
                  non_linguistic_symbols=args.non_linguistic_symbols,
                  text_name=getattr(args, "text_name", ["text"]),
                  text_cleaner=args.cleaner,
                  g2p_type=args.g2p,
                  **getattr(args, "preprocessor_conf", {}),
              )
      else:
          retval = None
      assert check_return_type(retval)
      return retval
  
imports: import argparse
  import copy
  import logging
  from typing import Callable, Collection, Dict, List, Optional, Tuple
  import numpy
  import torch
  from typeguard import check_argument_types, check_return_type
  from espnet2.asr.ctc import CTC
  from espnet2.asr.espnet_model import ESPnetASRModel
  from espnet2.diar.espnet_model import ESPnetDiarizationModel
  from espnet2.enh.espnet_enh_s2t_model import ESPnetEnhS2TModel
  from espnet2.enh.espnet_model import ESPnetEnhancementModel
  from espnet2.tasks.abs_task import AbsTask
  from espnet2.tasks.asr import ASRTask
  from espnet2.tasks.asr import decoder_choices
  from espnet2.tasks.asr import encoder_choices
  from espnet2.tasks.asr import frontend_choices, normalize_choices
  from espnet2.tasks.asr import postencoder_choices
  from espnet2.tasks.asr import preencoder_choices
  from espnet2.tasks.asr import specaug_choices
  from espnet2.tasks.diar import DiarizationTask
  from espnet2.tasks.diar import attractor_choices
  from espnet2.tasks.diar import decoder_choices
  from espnet2.tasks.diar import encoder_choices
  from espnet2.tasks.diar import frontend_choices
  from espnet2.tasks.diar import label_aggregator_choices
  from espnet2.tasks.diar import normalize_choices
  from espnet2.tasks.diar import specaug_choices
  from espnet2.tasks.enh import EnhancementTask
  from espnet2.tasks.enh import decoder_choices
  from espnet2.tasks.enh import encoder_choices
  from espnet2.tasks.enh import mask_module_choices
  from espnet2.tasks.enh import separator_choices
  from espnet2.tasks.st import STTask
  from espnet2.tasks.st import decoder_choices
  from espnet2.tasks.st import encoder_choices
  from espnet2.tasks.st import extra_asr_decoder_choices
  from espnet2.tasks.st import extra_mt_decoder_choices
  from espnet2.tasks.st import postencoder_choices
  from espnet2.tasks.st import preencoder_choices
  from espnet2.text.phoneme_tokenizer import g2p_choices
  from espnet2.torch_utils.initialize import initialize
  from espnet2.train.collate_fn import CommonCollateFn
  from espnet2.train.preprocessor import CommonPreprocessor, CommonPreprocessor_multi, MutliTokenizerCommonPreprocessor
  from espnet2.train.trainer import Trainer
  from espnet2.utils.get_default_kwargs import get_default_kwargs
  from espnet2.utils.nested_dict_action import NestedDictAction
  from espnet2.utils.types import int_or_none, str2bool, str_or_none
label_desc: Use image node_id 3 for calling the EnhS2TTask obj's underlying member method code with example usage: obj.build_preprocess_fn(cls, args, train) and returns: retval