'Informs our status listeners that a state change occurred.
:param stem.control.State state: state change that has occurred'

def _notify_status_listeners(self, state):

    with self._socket._get_send_lock():
        with self._status_listeners_lock:
            expect_alive = None
            if (state in (State.INIT, State.RESET)):
                expect_alive = True
            elif (state == State.CLOSED):
                expect_alive = False
            change_timestamp = time.time()
            if ((expect_alive is not None) and (expect_alive != self.is_alive())):
                return
            self._state_change_threads = list(filter((lambda t: t.is_alive()), self._state_change_threads))
            for (listener, spawn) in self._status_listeners:
                if spawn:
                    name = ('%s    notification' % state)
                    args = (self, state, change_timestamp)
                    notice_thread = threading.Thread(target=listener, args=args, name=name)
                    notice_thread.setDaemon(True)
                    notice_thread.start()
                    self._state_change_threads.append(notice_thread)
                else:
                    listener(self, state, change_timestamp)
