def METHOD_NAME(
    data: BaseModel,
    serializers: Optional[Sequence[Tuple[str, str, Callable]]] = None,
    negotiate: bool = False,
) -> Response:
    """Serialize either as JSON or YAML."""
    if negotiate:
        accept = get_accept_media_type()
    else:
        arg = request.args.get("format", "json")
        if arg not in FORMAT_MAP:
            return abort(
                400, f"unhandled value for `format`: {arg}. Use one of: {sorted(FORMAT_MAP)}"
            )
        accept = FORMAT_MAP[arg]
    if accept == "application/json":
        return current_app.response_class(
            json.dumps(data.dict(exclude_unset=True, exclude_none=True), ensure_ascii=False),
            mimetype="application/json",
        )
    elif accept in "application/yaml":
        return current_app.response_class(
            yaml.safe_dump(data.dict(exclude_unset=True, exclude_none=True), allow_unicode=True),
            mimetype="text/plain",
        )
    for _name, mimetype, func in serializers or []:
        if accept == mimetype:
            return current_app.response_class(func(data), mimetype=mimetype)
    return abort(404, f"unhandled media type: {accept}")