human
I wrote the below code

    f = BytesIO(''.join(chunks))
    k = None
    v = ''
    eof = False
    def _strip_last_newline(value):
        'Strip    the    last    newline    from    value'
        if (value and value.endswith('\n')):
            return value[:(-1)]
        return value
    for l in f:
        if l.startswith('    '):
            v += l[1:]
        else:
            if (k is not None):
                (yield (k, _strip_last_newline(v)))
            if (l == '\n'):
                break
            (k, v) = l.split('    ', 1)
    else:
        eof = True
        if (k is not None):
            (yield (k, _strip_last_newline(v)))
        (yield (None, None))
    if (not eof):
        (yield (None, f.read()))
    f.close()

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

def _parse_message(chunks):