<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def state(self, value):
 """Set device state. :type value: str :param value: Future state (either ON or OFF) """

        if value.upper() == ON:
            return self.SOAPAction('SetSocketSettings', 'SetSocketSettingsResult', self.controlParameters("1", "true"))
        elif value.upper() == OFF:
            return self.SOAPAction('SetSocketSettings', 'SetSocketSettingsResult', self.controlParameters("1", "false"))
        else:
            raise TypeError("State %s is not valid." % str(value))