from io import StringIO


def demo_app(environ, start_response):
    """Copy of wsgiref.simple_server.demo_app"""
    stdout = StringIO()
    print("Hello world!", file=stdout)
    print(file=stdout)
    h = sorted(environ.items())
    for k, v in h:
        print(k, "=", repr(v), file=stdout)
    start_response("200 OK", [("Content-Type", "text/plain; charset=utf-8")])
    return [stdout.getvalue().encode("utf-8")]