Making my suggested fix stopped the embedded Python error and allowed the rebase to complete, but I'm not certain the id being generated is ideal.
The epub has two files named 'BasicLatin.js' (in different folders). So after the first file gets the 'BasicLatin_js' id, the second one needs to use something different. But the code is producing 'BasicLatin_jscnt: 0001'.
It's doing what the code asks it to do at that point, but is a colon and a space best practice in an id attribute value?
Asking because I really don't know.