Well that seems a bit more complicated than I thought, what I'm trying right now instead is sort of reverse what you did for destroyers... In every SubHunter group I check if it's a patrol craft and then set that units shipclass to subchaser. I think that should turn all gunboats into subchasers, which is good enough for me until I learn more.
Code:
if group.groupName.find("SubHunter") != -1:
if group.groupName.find("Jap") != -1:
# less subhunter groups
group.spawnProbability *= 0.5
for unit in group.units:
if unit.type == UnitType.PATROL_CRAFT:
unit.shipClass="SCSubchaser"