def chunked(iterator, chunk_size):
    result = ''
    for chunk in iterator:
        result += chunk
        while len(result) >= chunk_size:
            newline_pos = result.rfind('\n', 0, chunk_size)
            if newline_pos == -1:
                newline_pos = chunk_size
            else:
                newline_pos += 1
            yield result[:newline_pos]
            result = result[newline_pos:]
    if result:
        yield result
Returns a delayed response
dataset/ETHPy150Open dropbox/changes/changes/utils/text.py/chunked--crossover with--dataset/ETHPy150Open mozillazg/bustard/tests/httpbin/core.py/delay_response