code: def apply_data_processor(
      per_sample_features: Dict,
      data_processors: Dict,
      feature_modalities: Dict,
      is_training: bool,
      load_only=False,
  ):
      """
      Process one sample's features.
  
      Parameters
      ----------
      per_sample_features
          Modality features of one sample.
      data_processors
          A dict of data processors.
      is_training
          Whether is training.
      load_only
          Whether to only load the data. Other processing steps may happen in dataset.__getitem__.
  
      Returns
      -------
      The processed features of one sample.
      """
      sample_features = {}
      for (
          per_modality,
          per_modality_processors,
      ) in data_processors.items():
          for per_model_processor in per_modality_processors:
              if (
                  per_modality in per_sample_features
                  and per_sample_features[per_modality]
              ):
                  sample_features.update(
                      per_model_processor(
                          per_sample_features[per_modality],
                          feature_modalities[per_modality],
                          is_training=is_training,
                          load_only=load_only,
                      )
                      if per_model_processor.prefix.lower().startswith(
                          MMDET_IMAGE
                      )
                      else per_model_processor(
                          per_sample_features[per_modality],
                          feature_modalities[per_modality],
                          is_training=is_training,
                      )
                  )
  
      return sample_features
  
imports: import ast
  import codecs
  import copy
  import re
  import warnings
  from io import BytesIO
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  import pandas
  import PIL
  from omegaconf import ListConfig
  from text_unidecode import unidecode
  from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD
  from tokenizers import pre_tokenizers
  from torchvision import transforms
  from ..constants import CLIP_IMAGE_MEAN, CLIP_IMAGE_STD, IDENTIFIER, IMAGE, IMAGE_BYTEARRAY, IMAGE_PATH, MMDET_IMAGE, MMLAB_MODELS
  from .collator import DictCollator
  from .preprocess_dataframe import MultiModalFeaturePreprocessor
  from .randaug import RandAugment
  from .trivial_augmenter import TrivialAugment
label_desc: Use image node_id 4 for calling a global function with example usage: apply_data_processor(per_sample_features, data_processors, feature_modalities, is_training, load_only) and returns: sample_features