code: def resample_datasets(self, lang_datasets, lang_pairs_all, epoch):
      # For train subset, additionally up or down sample languages.
      if self.args.multilang_sampling_alpha == 1.0:
          return lang_datasets
  
      dataset_lengths = np.array(
          [len(d) for d in lang_datasets],
          dtype=float,
      )
      sample_probs = self._get_sample_prob(dataset_lengths)
      logger.info(
          "Sample probability by language pair: {}".format(
              {
                  lp: "{0:.4f}".format(sample_probs[id])
                  for id, lp in enumerate(lang_pairs_all)
              }
          )
      )
      size_ratio = (
          sample_probs * dataset_lengths.sum()
      ) / dataset_lengths
      logger.info(
          "Up/Down Sampling ratio by language: {}".format(
              {
                  lp: "{0:.2f}".format(size_ratio[id])
                  for id, lp in enumerate(lang_pairs_all)
              }
          )
      )
  
      resampled_lang_datasets = [
          ResamplingDataset(
              lang_datasets[i],
              size_ratio=size_ratio[i],
              seed=self.args.seed,
              epoch=epoch,
              replace=size_ratio[i] >= 1.0,
          )
          for i, d in enumerate(lang_datasets)
      ]
      return resampled_lang_datasets
  
imports: import itertools
  import logging
  import os
  import re
  import numpy
  import torch
  from examples.speech_text_joint_to_text.data.pair_denoising_dataset import LanguagePairDenoisingDataset
  from fairseq import utils
  from fairseq.data import ConcatDataset, Dictionary, LanguagePairDataset, ResamplingDataset, TransformEosConcatLangPairDataset, TransformEosLangPairDataset, data_utils, indexed_dataset
  from fairseq.data.encoders.utils import get_whole_word_mask
  from fairseq.tasks import register_task
  from fairseq.tasks.translation import TranslationTask
label_desc: Use image node_id 6 for calling the PairedDenoisingTask obj's underlying member method code with example usage: obj.resample_datasets(lang_datasets, lang_pairs_all, epoch) and returns: resampled_lang_datasets, lang_datasets