How can I make a 3D wireframe object hollow?
It isn't necessary to use python, you can use Boolean modifiers to do this.

Add a boolean modifier to one of the spheres for every other sphere which intersects with it:



Then apply all the modifiers either by click apply for each one, or by pressing &#9095; AltC > Convert to mesh.

Result: