class_docstr: A similar Dataset to the TranslationDataset, but which loads tarred tokenized pickle files.
  Accepts a single JSON metadata file containing the total number of batches
  as well as the path(s) to the tarball(s) containing the pickled parallel dataset batch files.
  Valid formats for the text_tar_filepaths argument include:
  (1) a single string that can be brace-expanded, e.g. 'path/to/text.tar' or 'path/to/text_{1..100}.tar', or
  (2) a list of file paths that will not be brace-expanded, e.g. ['text_1.tar', 'text_2.tar', ...].
  Note: For brace expansion in (1), there may be cases where `{x..y}` syntax cannot be used due to shell interference.
  This occurs most commonly inside SLURM scripts. Therefore we provide a few equivalent replacements.
  Supported opening braces - { <=> (, [, < and the special tag _OP_.
  Supported closing braces - } <=> ), ], > and the special tag _CL_.
  For SLURM based tasks, we suggest the use of the special tags for ease of use.
  See the WebDataset documentation for more information about accepted data and input formats.
  If using multiple processes the number of shards should be divisible by the number of workers to ensure an
  even split among workers. If it is not divisible, logging will give a warning but training will proceed.
  Additionally, please note that the len() of this DataLayer is assumed to be the number of tokens
  of the text data. An incorrect manifest length may lead to some DataLoader issues down the line.
  Args:
      text_tar_filepaths: Either a list of tokenized text tarball filepaths, or a
          string (can be brace-expandable).
      metadata_path (str): Path to the metadata manifest.
      encoder_tokenizer: Autokenizer wrapped BPE tokenizer model, such as YTTM
      decoder_tokenizer: Autokenizer wrapped BPE tokenizer model, such as YTTM
      shuffle_n (int): How many samples to look ahead and load to be shuffled.
          See WebDataset documentation for more details.
          Defaults to 0.
      shard_strategy (str): Tarred dataset shard distribution strategy chosen as a str value during ddp.
          -   `scatter`: The default shard strategy applied by WebDataset, where each node gets
              a unique set of shards, which are permanently pre-allocated and never changed at runtime.
          -   `replicate`: Optional shard strategy, where each node gets all of the set of shards
              available in the tarred dataset, which are permanently pre-allocated and never changed at runtime.
              The benefit of replication is that it allows each node to sample data points from the entire
              dataset independently of other nodes, and reduces dependence on value of `shuffle_n`.
  
              .. warning::
                  Replicated strategy allows every node to sample the entire set of available tarfiles,
                  and therefore more than one node may sample the same tarfile, and even sample the same
                  data points! As such, there is no assured guarantee that all samples in the dataset will be
                  sampled at least once during 1 epoch. Scattered strategy, on the other hand, on specific
                  occasions (when the number of shards is not divisible with ``world_size``), will not sample
                  the entire dataset. For these reasons it is not advisable to use tarred datasets as validation
                  or test datasets.
      global_rank (int): Worker rank, used for partitioning shards. Defaults to 0.
      world_size (int): Total number of processes, used for partitioning shards. Defaults to 1.
      reverse_lang_direction (bool): When True, swaps the source and target directions when returning minibatches.
      prepend_id (int): Prepends the specificed token id to the start of every source sentence. Defaults to None.
code: def __len__(self):
      return self.length
  
imports: import io
  import json
  import pickle
  from collections import OrderedDict
  from dataclasses import dataclass
  from typing import Any, List, Optional
  import braceexpand
  import numpy
  import webdataset
  from torch.utils.data import IterableDataset
  from nemo.collections.nlp.data.data_utils.data_preprocessing import dataset_to_ids
  from nemo.core import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the TarredTranslationDataset obj's underlying member method code with example usage: obj.__len__() and returns: self