code: def format_wikicorpus(
      input, output, bytes, num_process, num_out_files, quiet
  ):
      if input is None:
          raise ValueError("input file is empty.")
      if not input.endswith("xml.bz2"):
          raise ValueError("input file not *.xml.bz2.")
      if not os.path.exists(output):
          os.makedirs(output)
  
      # Use WikiExtractor to extract the content
      wikiextractor = try_import_wikiextractor()
      from wikiextractor import WikiExtractor
  
      wiki_path = os.path.join(output, "extracted")
      # Overwrite the sys.argv
      sys.argv = ["prog", "-b", bytes, "-o", wiki_path, input]
      if quiet:
          sys.argv.append("--quiet")
      wikiextractor.WikiExtractor.main()
  
      # Merge extracted content into txt files
      prepared_path = os.path.join(output, "prepared_wikipedia")
      if not os.path.exists(prepared_path):
          os.makedirs(prepared_path)
      filenames = get_formatting_list(wiki_path, recursive=True)
      num_files = len(filenames)
      num_out_files = min(num_out_files, num_files)
      file_volume = math.ceil(num_files / num_out_files)
      splited_files = [
          filenames[i : i + file_volume]
          for i in range(0, num_files, file_volume)
      ]
      num_out_files = len(splited_files)
      output_files = [
          os.path.join(
              prepared_path,
              "wikipedia-prepared-{}.txt".format(str(i).zfill(4)),
          )
          for i in range(num_out_files)
      ]
      print(
          "All prepared raw text will be saved in {} txt files".format(
              num_out_files
          )
      )
      num_process = min(num_process, num_out_files)
      print(
          "Start preprocessing {} text files with {} cores".format(
              num_files, num_process
          )
      )
      process_args = [
          (splited_files[i], output_files[i])
          for i in range(num_out_files)
      ]
  
      start_time = time.time()
      with multiprocessing.Pool(num_process) as pool:
          f_read = 0
          for i, _ in enumerate(pool.imap(merge, process_args)):
              elapsed = time.time() - start_time
              f_read += len(splited_files[i])
              print(
                  "prepared {:} files, Elapsed: {:.2f}s, ETA: {:.2f}s, ".format(
                      f_read,
                      elapsed,
                      (num_files - f_read) / (num_files / elapsed),
                  )
              )
      print("Done preparation within {:.2f} seconds".format(elapsed))
  
imports: import os
  import sys
  import glob
  import math
  import time
  import tarfile
  import argparse
  import multiprocessing
  from collections import defaultdict
  from gluonnlp.utils.misc import download, load_checksum_stats
  from gluonnlp.utils.lazy_imports import try_import_wikiextractor
  from gluonnlp.base import get_repo_url
  from itertools import islice
  import nltk
  import statistics
  from segment_sentences import Sharding, segment_sentences, NLTKSegmenter
label_desc: Use image node_id 6 for calling a global function with example usage: format_wikicorpus(input, output, bytes, num_process, num_out_files, quiet) without return types