"""
Misc utilities for usage inside the framework.
"""
from werkzeug.wrappers import Response


def wrap_response(args, response_class: Response=Response) -> Response:
    """
    Wrap up a response, if applicable.
    This allows Flask-like `return "whatever"`.

    :param args: The arguments that are being wrapped.
    :param response_class: The Response class that is being used.
    """
    if not args:
        # Return a 204 NO CONTENT.
        return response_class("", status=204)

    if isinstance(args, tuple):
        # We enforce ``tuple`` here instead of any iterable.
        if len(args) == 1:
            # Only body, use 200 for the response code.
            return response_class(args[0], status=200)

        if len(args) == 2:
            # Body and status code.
            return response_class(args[0], status=args[1])

        if len(args) == 3:
            # Body, status code, and headers.
            return response_class(args[0], status=args[1], headers=args[2])

        raise TypeError("Cannot return more than 3 arguments from a view")

    if isinstance(args, response_class):
        # Return the bare response, unmodified.
        return args

    # Otherwise, wrap it in a response.
    return response_class(args)

@@ -89,16 +89,497 @@
 ponse%0A%0A%0A
+def as_html(text: str, code: int = 200, headers: dict = None) -%3E Response:%0A    %22%22%22%0A    Returns a HTML response.%0A    %0A    :param text: The text to return. %0A    :param code: The status code of the response.%0A    :param headers: Any optional headers.%0A    :return: A new :class:%60werkzeug.wrappers.Response%60 representing the HTML. %0A    %22%22%22%0A    if headers is None:%0A        headers = %7B%7D%0A%0A    r = Response(text, status=code, headers=%7B%22Content-Type%22: %22text/html%22, **headers%7D)%0A    return r%0A%0A%0A
 def wrap
@@ -618,17 +618,19 @@
 Response
-=
+ = 
 Response

Add `as_html` helper.