def METHOD_NAME(self, reason=None):
    self._active = False
    if reason is not None:
        log.error("Data input failed due to an error: {}".format(reason))
    if self._shutdown_fun and self._started:
        self._shutdown_fun()
    if self._state:
        self._state.stop()
    self._started = False