'Remove element named \'name\' from the collection'

def remove(self, name, with_delete=True, with_sync=True, with_triggers=True, recursive=True, logger=None):

    name = name.lower()
    if (not recursive):
        for v in self.collection_mgr.systems():
            if ((v.image is not None) and (v.image.lower() == name)):
                raise CX((_('removal    would    orphan    system:    %s') % v.name))
    obj = self.find(name=name)
    if (obj is not None):
        if recursive:
            kids = obj.get_children()
            for k in kids:
                self.collection_mgr.api.remove_system(k, recursive=True, logger=logger)
        if with_delete:
            if with_triggers:
                utils.run_triggers(self.collection_mgr.api, obj, '/var/lib/cobbler/triggers/delete/image/pre/*', [], logger)
            if with_sync:
                lite_sync = action_litesync.CobblerLiteSync(self.collection_mgr, logger=logger)
                lite_sync.remove_single_image(name)
        self.lock.acquire()
        try:
            del self.listing[name]
        finally:
            self.lock.release()
        self.collection_mgr.serialize_delete(self, obj)
        if with_delete:
            if with_triggers:
                utils.run_triggers(self.collection_mgr.api, obj, '/var/lib/cobbler/triggers/delete/image/post/*', [], logger)
                utils.run_triggers(self.collection_mgr.api, obj, '/var/lib/cobbler/triggers/change/*', [], logger)
        return
    raise CX((_('cannot    delete    an    object    that    does    not    exist:    %s') % name))
