def write_sentence(t, f):
    """writes a sentence in export format
        and does NOT write the #EOS"""
    for n in t.terminals:
        if n.parent:
            parent_id = n.parent.id
        else:
            parent_id = '0'
        extra = ''
        if hasattr(n, 'secedge') and n.secedge is not None:
            for secedge in n.secedge:
                tgt = secedge[1]
                if tgt.isTerminal():
                    tgt_id = tgt.start
                else:
                    tgt_id = tgt.id
                extra += '\t%s %s' % (secedge[0], tgt_id)
        if hasattr(n, 'comment') and n.comment:
            if extra:
                extra += ' '
            else:
                extra = '     '
            extra += '%% ' + n.comment
        f.write('%-23s %-7s %-15s %-7s %s%s\n' % (n.word, n.cat, n.morph, n
            .edge_label, parent_id, extra))
    all_nodes = t.node_table.values()
    all_nodes.sort(key=lambda n: n.id)
    for n in all_nodes:
        if n.parent:
            parent_id = n.parent.id
        else:
            parent_id = '0'
        extra = ''
        if hasattr(n, 'secedge') and n.secedge is not None:
            extra = '     %-7s %s' % (n.secedge[0], n.secedge[1].id)
        f.write('#%-22s %-7s %-15s %-7s %s%s\n' % (n.id, n.cat, n.attr, n.
            edge_label, parent_id, extra))
