While the tone of the original commenter was a bit snarky, and the comments about real ISO images didn't make any sense, it is true that the functionality of the two python scripts you wrote is largely subsumed by /usr/share/comps-extras/getnotincomps.py | xargs rm, if you have removed all groups and other references except for Core and Base.