class_docstr: Extension of fairseq.data.BacktranslationDataset where each example
  has a weight in [0.0, 1.0], which will be used to weigh the loss.
  
  Args:
      weights (list): list of per example weight values; each example
      has a weight in [0.0, 1.0]. Alternatively, when weights consists of a
      single value, that value is broadcast as weight to all examples. [0.0]
      gives 0 weight to all examples.
code: def __getitem__(self, i):
      example = self.dataset.__getitem__(i)
      if self.weights:
          """
          If weight for example is missing, use last seen weight. Sometimes we just
          want to assign a weight to the entire dataset with a single value but also
          maintain the list convention of weights. This way, even if we don't care or
          don't know about dataset size, we can assign same weight to all examples.
          """
          if len(self.weights) <= i:
              example["weight"] = self.weights[-1]
          else:
              example["weight"] = self.weights[i]
      else:
          example["weight"] = 1.0
  
      return example
  
imports: import torch
  from fairseq import data
label_desc: Use image node_id 3 for calling the WeightedBacktranslationDataset obj's underlying member method code with example usage: obj.__getitem__(i) and returns: example