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

    node_attrs = docgraph.node[node_id]
    if istoken(docgraph, node_id):
        token_str = escape_func(node_attrs[docgraph.ns+':token'])
        if include_pos:
            pos_str = escape_func(node_attrs.get(docgraph.ns+':pos', ''))
            return u"({pos}({token}){child})".format(
                pos=pos_str, token=token_str, child=child_str)
        else:
            return u"({token}{child})".format(token=token_str, child=child_str)

    else:  # node is not a token
        label_str=escape_func(node_attrs.get('label', node_id))
        return u"({label}{child})".format(label=label_str, child=child_str)