def _destroy_object(self,obj,id=-1):
        """Internal helper to automatically destroy a stimulus object."""
        try:
            if id > 0 and self.implicit_markers:
                self.marker(id)
            if not (type(obj) == list or type(obj) == tuple):
                obj = [obj]
                
            for o in obj:
                if o is not None:
                    if hasattr(o,'destroy'):
                        o.destroy()
                    elif hasattr(o,'stop'):
                        o.stop()
                    else:
                        del o
                    # remove from cancel list
                    self._to_destroy.remove(o)
        except:
            pass
dataset/ETHPy150Open sccn/SNAP/src/framework/basicstimuli.py/BasicStimuli._destroy_object/original