'hook function'

def func(self):

    player = self.player
    if ('all' in self.switches):
        player.msg('|RQuitting|n    all    sessions.    Hope    to    see    you    soon    again.', session=self.session)
        for session in player.sessions.all():
            player.disconnect_session_from_player(session)
    else:
        nsess = len(player.sessions.all())
        if (nsess == 2):
            player.msg('|RQuitting|n.    One    session    is    still    connected.', session=self.session)
        elif (nsess > 2):
            player.msg(('|RQuitting|n.    %i    sessions    are    still    connected.' % (nsess - 1)), session=self.session)
        else:
            player.msg('|RQuitting|n.    Hope    to    see    you    again,    soon.', session=self.session)
        player.disconnect_session_from_player(self.session)
