code: def calculate_length_statistics(source_iterables: Sequence[Iterable[Any]],
                                  target_iterable: Iterable[Any],
                                  max_seq_len_source: int,
                                  max_seq_len_target: int) -> 'LengthStatistics':
      
      mean_and_variance = OnlineMeanAndVariance()
  
      for sources, target in parallel_iter(source_iterables, target_iterable):
          source_len = len(sources[0])
          target_len = len(target)
          if source_len > max_seq_len_source or target_len > max_seq_len_target:
              continue
  
          length_ratio = target_len / source_len
          mean_and_variance.update(length_ratio)
  
      return LengthStatistics(mean_and_variance.count, mean_and_variance.mean, mean_and_variance.std)
docs: Returns mean and standard deviation of target-to-source length ratios of parallel corpus.
  
      :param source_iterables: Source sequence readers.
      :param target_iterable: Target sequence reader.
      :param max_seq_len_source: Maximum source sequence length.
      :param max_seq_len_target: Maximum target sequence length.
      :return: The number of sentences as well as the mean and standard deviation of target to source length ratios.