def encode(self, splitchars=';, '):
        newchunks = []
        maxlinelen = self._firstlinelen
        lastlen = 0
        for s, charset in self._chunks:
            # The first bit of the next chunk should be just long enough to
            # fill the next line.  Don't forget the space separating the
            # encoded words.
            targetlen = maxlinelen - lastlen - 1
            if targetlen < charset.encoded_header_len(''):
                # Stick it on the next line
                targetlen = maxlinelen
            newchunks += self._split(s, charset, targetlen, splitchars)
            lastchunk, lastcharset = newchunks[-1]
            lastlen = lastcharset.encoded_header_len(lastchunk)
        return self._encode_chunks(newchunks, maxlinelen)
L{DeferredContext.addActionFinish} passes through a failed result
dataset/ETHPy150Open babble/babble/include/jython/Lib/email/header.py/Header.encode--crossover with--dataset/ETHPy150Open ClusterHQ/eliot/eliot/tests/test_twisted.py/DeferredContextTests.test_addActionFinishFailurePassThrough