Mirroring a Child Object

Hello,
I’m trying to write a script that will mirror a child object. I started with this post from Blender Stack Exchange.

This script works when the object is unparented, but it doesn’t work when there is a parent object.

import bpy
import mathutils

ob = bpy.context.object
parent = ob.parent

mat_mirror = mathutils.Matrix.Scale(-1, 4, (1.0, 0.0, 0.0))
ob.matrix_world = mat_mirror @ ob.matrix_world
#ob.matrix_world = parent.matrix_world.inverted() @ ob.matrix_world

I thought that by multiplying the object’s matrix_world by a mirrored Matrix that I’d get the correct mirrored world Matrix, but I’m getting some strange results:
Mirroring

I tried multiplying the child’s matrix_world by the parent’s inverted matrix_world (commented out), but that didn’t work either.

Can anyone help me to get this child object to mirror across the x-axis? Thank you!