docs: def get_plaintext_document_body(fpath, keep_layout=False):
      """Given a file-path to a full-text, return a list of unicode strings.
  
      Each string is a line of the fulltext.
      In the case of a plain-text document, this simply means reading the
      contents in from the file. In the case of a PDF/PostScript however,
      this means converting the document to plaintext.
  
      :param fpath: (string) - the path to the fulltext file
      :return: (list) of strings - each string being a line in the document.
      """
      textbody = []
      status = 0
      if os.access(fpath, os.F_OK | os.R_OK):
          # filepath OK - attempt to extract references:
          # get file type:
          cmd_pdftotext = [
              current_app.config.get("CLASSIFIER_PATH_GFILE"), fpath
          ]
          pipe_pdftotext = subprocess.Popen(cmd_pdftotext,
                                            stdout=subprocess.PIPE)
          res_gfile = pipe_pdftotext.stdout.read()
  
          if (res_gfile.lower().find("text") != -1) and \
                  (res_gfile.lower().find("pdf") == -1):
              # plain-text file: don't convert - just read in:
              f = open(fpath, "r")
              try:
                  textbody = [line.decode("utf-8") for line in f.readlines()]
              finally:
                  f.close()
          elif (res_gfile.lower().find("pdf") != -1) or \
                  (res_gfile.lower().find("pdfa") != -1):
              # convert from PDF
              (textbody, status) = convert_PDF_to_plaintext(fpath, keep_layout)
          else:
              # invalid format
              status = 1
      else:
          # filepath not OK
          status = 1
      return (textbody, status)