human
I wrote the below code

    from nltk import tree
    def do_pnp(pnp):
        s = '    '.join([do_chunk(ch) for ch in pnp.chunks])
        return ('(PNP    %s)' % s)
    def do_chunk(ch):
        s = '    '.join([('(%s    %s)' % (w.pos, w.string)) for w in ch.words])
        s += '    '.join([do_pnp(pnp) for pnp in ch.attachments])
        return ('(%s    %s)' % (ch.type, s))
    T = ['(S']
    v = []
    for ch in sentence.chunked():
        if ((not ch.pnp) and isinstance(ch, Chink)):
            T.append(('(%s    %s)' % (ch.words[0].pos, ch.words[0].string)))
        elif (not ch.pnp):
            T.append(do_chunk(ch))
        elif ((ch.pnp.anchor is None) and (ch.pnp not in v)):
            T.append(do_pnp(ch.pnp))
            v.append(ch.pnp)
    T.append(')')
    return tree.bracket_parse('    '.join(T))

What's a good function header?
assistant
#Here's a good function header.

def nltk_tree(sentence):