code: def write_json_corpus(documents, fnm):
      
      with codecs.open(fnm, 'wb', 'ascii') as f:
          for document in documents:
              f.write(json.dumps(document) + '\n')
      return documents
docs: Write a lisst of Text instances as JSON corpus on disk.
      A JSON corpus contains one document per line, encoded in JSON.
  
      Parameters
      ----------
      documents: iterable of estnltk.text.Text
          The documents of the corpus
      fnm: str
          The path to save the corpus.