Hi, I'm Matt and am certain I can help you (23 years of IT, web mastering and multimedia experience, 5+ scripting web animations/visualizations with SVG).
I've checked your references several times (videos and Inkscape extension) and I would redo it in PHP (I know much more than Python). The call to the script (1st step of your task) would be with two parameters, one as your image and the second particular named/numbered shapes from the template provided on your Inkscape extension webiste.
The second part is maybe easier or harder when I get more details/scripting of it. SVG images by themselves are resizable (if there is no width and height set) and fitting given frame can be a simple task of setting a viewbox e.g. image dimension to be the same as for a frame. Yet it can mean more scripting if results would be inadequate (though shape "warping" uses the same principle, keeping relative proportions/sizes of letters).
This scripting task require more manual work and tweaking than usual so this is my final bid offer. If something can be done with SVG I will implement it (know SVG 1.1 specification very well now).
Looking forward to your reply,
Matt
P.S. I have one scripting SVG (server-side) script task here on Freelancer that I expect to finish this night. Then I'm free at the moment.