def _event_stream_output(request, output):
    if not request._started:
        request.send_status()
        request.send_headers({'Content-Type': 'text/event-stream'})

    if output is Finished:
        # We're finished.
        request.connection.close()
        _cleanup(request)
        return

    if isinstance(output, tuple):
        output, headers = output
    else:
        headers = {}

    if not output and not headers:
        # Send a simple comment line for keep-alive.
        request.write(":\r\n")
        return Again

    if output is None:
        output = ""
    else:
        # Cast the output into something usable.
        output = _cast(request, output)

    # Split up output, adding "data:" field names, and then prepend the
    # provided headers, if there are any.
    output = "\r\n".join("data: %s" % x for x in output.splitlines())
    for key, value in headers.iteritems():
        output = "%s: %s\r\n%s" % (key, _cast(request, value), output)

    # Write it out, with an extra blank line so that the client will read
    # the message.
    request.write("%s\r\n\r\n" % output)
    return Again


###############################################################################
# Asynchronous _Sleeper
###############################################################################
Returns the zone that the GCE instance running this code is running within.
dataset/ETHPy150Open ecdavis/pants/pants/web/asynchronous.py/_event_stream_output--crossover with--dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/agents/gce.py/get_machine_zone