def stream_as_text(stream):
    for data in stream:
        if not isinstance(data, six.text_type):
            data = data.decode('utf-8', 'replace')
        yield data
Given a stream of bytes or text, if any of the items in the stream
dataset/ETHPy150Open docker/compose/compose/utils.py/stream_as_text