def error_app(msg):
    """
    A trivial WSGI app that always displays a 500 error with a given message

    Parameters:

    :msg: The message to display in the response body with the 500 error
    """
    def _app(_, start_response):
        response_body = msg
        status = '500 Error'
        response_headers = [
            ('Content-Type', 'text/plain'),
            ('Content-Length', str(len(response_body)))
        ]
        start_response(status, response_headers)
        return [response_body]
    return _app