docstr:        Writes the doc as a conll file to the given file.
  
         If passed a string, that filename will be opened.  Otherwise, filename.write() will be called.
  
         Note that the output needs an extra 
  
  at the end to be a legal output file
         
docstr_tok: ["Writes","the","doc","as","a","conll","file","to","the","given","file",".","If","passed","a","string",",","that","filename","will","be","opened",".","Otherwise",",","filename.write","(",")","will","be","called",".","Note","that","the","output","needs","an","extra","at","the","end","to","be","a","legal","output","file"]
code: def write_doc2conll(doc, filename, mode="w", encoding="utf-8"):
      """
      Writes the doc as a conll file to the given file.
  
      If passed a string, that filename will be opened.  Otherwise, filename.write() will be called.
  
      Note that the output needs an extra \n\n at the end to be a legal output file
      """
      if hasattr(filename, "write"):
          filename.write("{:C}\n\n".format(doc))
      else:
          with open(filename, mode, encoding=encoding) as outfile:
              outfile.write("{:C}\n\n".format(doc))
  
file_path: stanza/stanza/utils/conll.py
imports: import os
  import io
  from zipfile import ZipFile
  from stanza.models.common.doc import Document
  from stanza.models.common.doc import ID, TEXT, LEMMA, UPOS, XPOS, FEATS, HEAD, DEPREL, DEPS, MISC, NER, START_CHAR, END_CHAR
  from stanza.models.common.doc import FIELD_TO_IDX, FIELD_NUM
label_desc: Use image node_id 8 for calling the CoNLL obj's underlying member method code with example usage: obj.write_doc2conll(doc, filename, mode, encoding) without return types