<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def lock(self):
 """Lock the device."""

        success = self.set_status(CONST.STATUS_LOCKCLOSED_INT)

        if success:
            self._json_state['status'] = CONST.STATUS_LOCKCLOSED

        return success