def disconnect(self, handler):
        with self._handlerslock:
            try:
                self._handlers.remove(handler)
            except KeyError:
                raise ValueError, \
                    "Handler %s not associated with this session" % handler
            num_handlers = len(self._handlers)
        if num_handlers == 0:
            # shut down this session unless we are instantiating, running,
            # or collecting final data
            if self.getstate() < coreapi.CORE_EVENT_INSTANTIATION_STATE or \
                    self.getstate() > coreapi.CORE_EVENT_DATACOLLECT_STATE:
                self.shutdown()
Test that adding a user to a group fires the correct django signal
dataset/ETHPy150Open coreemu/core/daemon/core/session.py/Session.disconnect--crossover with--dataset/ETHPy150Open ofa/connect/open_connect/groups/tests/test_tasks.py/TestAddUserToGroup.test_fires_added_to_group_signal