import pymxs
rt = pymxs.runtime
def delete_similar_named_objs(in_name):
rt.select(rt.objects)
to_delete = []
for s in rt.selection:
if in_name in s.name:
to_delete.append(s) # using rt.delete(s) doesn't get all the objects for some reason
rt.delete(to_delete)