def output_stream(command, stream, logs):
    if command and command in STREAM_FORMATTERS:
        formatter = STREAM_FORMATTERS[command](stream)
    else:
        formatter = StreamFormatter(stream)

    stream_count = formatter.output()

    if stream_count == 0 and logs and callable(logs):
        # Something nasty has happened and we got an empty
        # output stream. But we have logs. Let's show those.
        lines = logs()
        if lines:
            lines = lines.split('\n')
            for line in lines:
                click.echo(line)
Ensure field converts to string during _meta access
dataset/ETHPy150Open j-bennet/wharfee/wharfee/formatter.py/output_stream--crossover with--dataset/ETHPy150Open jamesturk/django-markupfield/markupfield/tests/tests.py/MarkupFieldTestCase.test_value_to_string