def METHOD_NAME(request, tag_code):
    if request.method != "POST":
        raise Http404()
    tag = get_object_or_404(Tag, code=tag_code)
    user_tag, is_created = UserTag.objects.get_or_create(
        user=request.me, tag=tag, defaults=dict(name=tag.name)
    )
    if not is_created:
        user_tag.delete()
    SearchIndex.update_user_tags(request.me)
    return {
        "status": "created" if is_created else "deleted",
        "tag": {"code": tag.code, "name": tag.name, "color": tag.color},
    }