code: def write_paired_text(
      src,
      tgt,
      fname,
      append=False,
      mode="h",
      sep="\t",
      src_fname_suffix="src",
      tgt_fname_suffix="tgt",
  ):
      """Writes paired text to a file.
  
      Args:
          src: A list (or array) of `str` source text.
          tgt: A list (or array) of `str` target text.
          fname (str): The output filename.
          append (bool): Whether append content to the end of the file if exists.
          mode (str): The mode of writing, with the following options:
  
              - **'h'**: The "horizontal" mode. Each source target pair is \
                  written in one line, intervened with :attr:`sep`, e.g.::
  
                      source_1 target_1
                      source_2 target_2
  
              - **'v'**: The "vertical" mode. Each source target pair is \
                  written in two consecutive lines, e.g::
  
                      source_1
                      target_1
                      source_2
                      target_2
  
              - **'s'**: The "separate" mode. Each source target pair is \
                      written in corresponding lines of two files named \
                      as `"{fname}.{src_fname_suffix}"` \
                      and `"{fname}.{tgt_fname_suffix}"`, respectively.
  
          sep (str): The string intervening between source and target. Used
              when :attr:`mode` is set to 'h'.
          src_fname_suffix (str): Used when :attr:`mode` is 's'. The suffix to
              the source output filename. E.g., with
              `(fname='output', src_fname_suffix='src')`, the output source file
              is named as `output.src`.
          tgt_fname_suffix (str): Used when :attr:`mode` is 's'. The suffix to
              the target output filename.
  
      Returns:
          The fileanme(s). If `mode` == 'h' or 'v', returns
          :attr:`fname`. If `mode` == 's', returns a list of filenames
          `["{fname}.src", "{fname}.tgt"]`.
      """
      fmode = "a" if append else "w"
      if mode == "s":
          fn_src = "{}.{}".format(fname, src_fname_suffix)
          fn_tgt = "{}.{}".format(fname, tgt_fname_suffix)
          with open(fn_src, fmode, encoding="utf-8") as fs:
              fs.write(as_text("\n".join(src)))
              fs.write("\n")
          with open(fn_tgt, fmode, encoding="utf-8") as ft:
              ft.write(as_text("\n".join(tgt)))
              ft.write("\n")
          return fn_src, fn_tgt
      else:
          with open(fname, fmode, encoding="utf-8") as f:
              for s, t in zip(src, tgt):
                  if mode == "h":
                      text = "{}{}{}\n".format(
                          as_text(s), sep, as_text(t)
                      )
                      f.write(as_text(text))
                  elif mode == "v":
                      text = "{}\n{}\n".format(as_text(s), as_text(t))
                      f.write(as_text(text))
                  else:
                      raise ValueError("Unknown mode: {}".format(mode))
          return fname
  
file_path: texar/texar/tf/utils/utils_io.py
imports: from io import open
  import os
  import importlib
  import yaml
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: write_paired_text(src, tgt, fname, append, mode, sep, src_fname_suffix, tgt_fname_suffix) and returns: fn_src,  fn_tgt, fname