code: def get_news20(source_dir="./data/news20/"):
      """
      Parse or download news20 if source_dir is empty.
  
      :param source_dir: The directory storing news data.
      :return: A list of (tokens, label)
      """
      news_dir = download_news20(source_dir)
      texts = []  # list of text samples
      label_id = 0
      for name in sorted(os.listdir(news_dir)):
          path = os.path.join(news_dir, name)
          label_id += 1
          if os.path.isdir(path):
              for fname in sorted(os.listdir(path)):
                  if fname.isdigit():
                      fpath = os.path.join(path, fname)
                      kargs = {}
                      if not (sys.version_info < (3,)):
                          kargs["encoding"] = "latin-1"
                      with open(fpath, **kargs) as f:
                          content = f.read()
                          texts.append((content, label_id))
  
      print("Found %s texts." % len(texts))
      return texts
  
imports: import tarfile
  from bigdl.dllib.feature.dataset import base
  import os
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: get_news20(source_dir) and returns: texts