How do I select vertices by material slot in Python?
Okay, I figured it out (and I'm dumb and if there is a way to delete these questions you answer yourself I would).

All I had to do was to set the active index of the material and then do a material slot select (as I already had).  So this works:

for num, m in enumerate(imported.material_slots):
    ...
    bpy.context.object.active_material_index = num
    bpy.ops.object.material_slot_select()


Now just to make a new material, assign the faces to it, and delete all the old ones, but I think I have that.