<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def docgraph2freqt(docgraph, root=None, include_pos=False, escape_func=FREQT_ESCAPE_FUNC):
 """convert a docgraph into a FREQT string."""

    if root is None:
        return u"\n".join(
            sentence2freqt(docgraph, sentence, include_pos=include_pos,
                           escape_func=escape_func)
            for sentence in docgraph.sentences)
    else:
        return sentence2freqt(docgraph, root, include_pos=include_pos,
                              escape_func=escape_func)