def METHOD_NAME(
    after_request: AfterRequestHookHandler | None,
    background: BackgroundTask | BackgroundTasks | None,
    cookies: frozenset[Cookie],
    headers: frozenset[ResponseHeader],
    media_type: str,
    response_class: ResponseType,
    status_code: int,
    type_encoders: TypeEncodersMap | None,
) -> AsyncAnyCallable:
    """Create a handler function for arbitrary data.
    Args:
        after_request: An after request handler.
        background: A background task or background tasks.
        cookies: A set of pre-defined cookies.
        headers: A set of response headers.
        media_type: The response media type.
        response_class: The response class to use.
        status_code: The response status code.
        type_encoders: A mapping of types to encoder functions.
    Returns:
        A handler function.
    """
    raw_headers = encode_headers(normalize_headers(headers).items(), cookies, [])
    async def handler(
        data: Any,
        request: Request[Any, Any, Any],
        app: Litestar,
        **kwargs: Any,
    ) -> ASGIApp:
        if isawaitable(data):
            data = await data
        response = response_class(
            background=background,
            content=data,
            media_type=media_type,
            status_code=status_code,
            type_encoders=type_encoders,
        )
        if after_request:
            response = await after_request(response)  # type: ignore[arg-type,misc]
        return response.to_asgi_response(app=None, request=request, encoded_headers=raw_headers)
    return handler