<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _reset_state_mode(self, state, mode):
 """ Reset the state mode to the given mode, and apply the custom state options specified with this analysis. :param state: The state to work with. :param str mode: The state mode. :return: None """


        state.set_mode(mode)
        state.options |= self._state_add_options
        state.options = state.options.difference(self._state_remove_options)