code: def _prepare_lambada_data(
      tmp_dir, data_dir, vocab_size, vocab_filename
  ):
      """Downloading and preparing the dataset.
  
      Args:
        tmp_dir: tem directory
        data_dir: data directory
        vocab_size: size of vocabulary
        vocab_filename: name of vocab file
  
      """
  
      if not tf.gfile.Exists(data_dir):
          tf.gfile.MakeDirs(data_dir)
  
      file_path = generator_utils.maybe_download(tmp_dir, _TAR, _URL)
      tar_all = tarfile.open(file_path)
      tar_all.extractall(tmp_dir)
      tar_all.close()
      tar_train = tarfile.open(
          os.path.join(tmp_dir, "train-novels.tar")
      )
      tar_train.extractall(tmp_dir)
      tar_train.close()
  
      vocab_path = os.path.join(data_dir, vocab_filename)
      if not tf.gfile.Exists(vocab_path):
          with tf.gfile.GFile(
              os.path.join(tmp_dir, _VOCAB), "r"
          ) as infile:
              reader = csv.reader(infile, delimiter="\t")
              words = [row[0] for row in reader]
              words = [_UNK] + words[:vocab_size]
          with tf.gfile.GFile(vocab_path, "w") as outfile:
              outfile.write("\n".join(words))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import csv
  import os
  import tarfile
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: _prepare_lambada_data(tmp_dir, data_dir, vocab_size, vocab_filename) without return types