def METHOD_NAME(request, profile):
    if request.method == "POST":
        is_avatar_locked = profile.is_avatar_locked
        serializer = ModerateAvatarSerializer(profile, data=request.data)
        if not serializer.is_valid():
            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
        if serializer.validated_data["is_avatar_locked"] and not is_avatar_locked:
            avatars.dynamic.set_avatar(profile)
        serializer.save()
        return Response(
            {
                "avatars": profile.avatars,
                "is_avatar_locked": int(profile.is_avatar_locked),
                "avatar_lock_user_message": profile.avatar_lock_user_message,
                "avatar_lock_staff_message": profile.avatar_lock_staff_message,
            }
        )
    return Response(
        {
            "is_avatar_locked": int(profile.is_avatar_locked),
            "avatar_lock_user_message": profile.avatar_lock_user_message,
            "avatar_lock_staff_message": profile.avatar_lock_staff_message,
        }
    )