code: def write_files_from_queues(sample_path, queues):
      """
      Standalone process that reads data from
      queues in order and write to sample files.
      """
      os.makedirs(sample_path, exist_ok=True)
      for c_name in queues.keys():
          dest_base = os.path.join(
              sample_path, "{}.{}".format(c_name, CorpusName.SAMPLE)
          )
          with open(
              dest_base + ".src", "w", encoding="utf-8"
          ) as f_src, open(
              dest_base + ".tgt", "w", encoding="utf-8"
          ) as f_tgt:
              while True:
                  _next = False
                  for q in queues[c_name]:
                      item = q.get()
                      if item == "blank":
                          continue
                      if item == "break":
                          _next = True
                          break
                      _, src_line, tgt_line = item
                      f_src.write(src_line + "\n")
                      f_tgt.write(tgt_line + "\n")
                  if _next:
                      break
  
imports: import os
  import copy
  import multiprocessing
  import pyonmttok
  from functools import partial
  from onmt.utils.logging import init_logger, logger
  from onmt.utils.misc import set_random_seed, check_path
  from onmt.utils.parse import ArgumentParser
  from onmt.opts import data_prepare_opts
  from onmt.inputters.text_corpus import build_corpora_iters, get_corpora
  from onmt.inputters.text_utils import process, append_features_to_text
  from onmt.transforms import make_transforms, get_transforms_cls
  from onmt.constants import CorpusName, CorpusTask
  from collections import Counter
label_desc: Use image node_id 1 for calling a global function with example usage: write_files_from_queues(sample_path, queues) without return types