def METHOD_NAME(
    allow_credentials=False,
    allow_headers=None,
    allow_methods=None,
    expose_headers=None,
    max_age=86400,
):
    """
    View decorator factory that provides CORS support.
    CORS stands for "Cross-Origin Resource Sharing," and is a protocol
    implemented in browsers to allow safe dispatch of XMLHttpRequests across
    origins.
    To CORS-enable a view:
     1. Create a decorator using this function and set it as the view's
        decorator when calling `add_view`.
     2. To support requests that do not qualify as "simple requests" [1], add a
        preflight view using `add_preflight_view`.
    [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Simple_requests
    """
    def cors_decorator(wrapped):
        def wrapper(context, request):
            response = wrapped(context, request)
            return set_cors_headers(
                request,
                response,
                allow_credentials=allow_credentials,
                allow_headers=allow_headers,
                allow_methods=allow_methods,
                expose_headers=expose_headers,
                max_age=max_age,
            )
        return wrapper
    return cors_decorator