code: def text2lines(textpath, lines_content=None):
      """
      read lines from text or write lines to txt
      :param textpath: filepath of text
      :param lines_content: list of lines or None, None means read
      :return: processed lines content for read while None for write
      """
      if lines_content is None:
          with codecs.open(textpath, "r") as handle:
              lines_content = handle.readlines()
          processed_lines = list(
              map(
                  lambda x: x[:-1] if x[-1] in ["\n"] else x,
                  lines_content,
              )
          )
          return processed_lines
      else:
          processed_lines = list(
              map(
                  lambda x: x if x[-1] in ["\n"] else "{}\n".format(x),
                  lines_content,
              )
          )
          with codecs.open(textpath, "w") as handle:
              handle.write("".join(processed_lines))
          return None
  
imports: import argparse
  import codecs
  import glob
  import os
  import sys
  from multiprocessing import Pool
label_desc: Use image node_id 1 for calling a global function with example usage: text2lines(textpath, lines_content) and returns: processed_lines, None