<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(self):
 """ Explicitly terminate the connection to the remote host. This discards any local state we hold for the connection, returns the Connection to the 'disconnected' state, and informs ContextService the connection is bad somehow, and should be shut down and discarded. """

        if self._task_vars is None:
            self._reset_find_task_vars()

        if self._play_context.remote_addr is None:
            # <2.5.6 incorrectly populate PlayContext for reset_connection
            # https://github.com/ansible/ansible/issues/27520
            raise ansible.errors.AnsibleConnectionFailure(
                self.reset_compat_msg
            )

        self._connect()
        self._mitogen_reset(mode='reset')
        self._shutdown_broker()