<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stop(self):
 """Stops the Kinect2 sensor stream. Returns ------- bool True if the stream was stopped, False if the device was already stopped or was not otherwise available. """

        # check that everything is running
        if not self._running or self._device is None:
            logging.warning('Kinect2 device %d not runnning. Aborting stop' %(self._device_num))
            return False

        # stop the device
        self._device.stop()
        self._device.close()
        self._device = None
        self._running = False
        return True