<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_active_state(self, name, value):
 """Set active state."""

        if name not in self.__active_states.keys():
            raise ValueError("Can not set unknown state '" + name + "'")

        if (isinstance(self.__active_states[name], int) and
                isinstance(value, str)):
            # we get an update as str but current value is
            # an int, try to convert
            self.__active_states[name] = int(value)
        elif (isinstance(self.__active_states[name], float) and
              isinstance(value, str)):
            # we get an update as str but current value is
            # a float, try to convert
            self.__active_states[name] = float(value)
        else:
            self.__active_states[name] = value