<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toggle_state(self, state, active=TOGGLE):
 """ Toggle the given state for this conversation. The state will be set ``active`` is ``True``, otherwise the state will be removed. If ``active`` is not given, it will default to the inverse of the current state (i.e., ``False`` if the state is currently set, ``True`` if it is not; essentially toggling the state). For example:: conv.toggle_state('{relation_name}.foo', value=='foo') This will set the state if ``value`` is equal to ``foo``. """

        if active is TOGGLE:
            active = not self.is_state(state)
        if active:
            self.set_state(state)
        else:
            self.remove_state(state)