<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_mode(self, mode):
 """Set Lupusec alarm mode."""

        _LOGGER.debug('State change called from alarm device')
        if not mode:
            _LOGGER.info('No mode supplied')
        elif mode not in CONST.ALL_MODES:
            _LOGGER.warning('Invalid mode')
        response_object = self._lupusec.set_mode(CONST.MODE_TRANSLATION[mode])
        if response_object['result'] != 1:
            _LOGGER.warning('Mode setting unsuccessful')

        self._json_state['mode'] = mode
        _LOGGER.info('Mode set to: %s', mode)
        return True