presence and disconnect features

I use this for starting so we always disconnect properly in my "__main__"

    def start():
        loop = asyncio.get_event_loop()

        if _platform is not 'win32': # *ix case
            def on_shutdown(client):
                _log.warning('Shutting down!!')
                client.disconnect()

            for signame in ('SIGINT', 'SIGTERM'):
                loop.add_signal_handler(getattr(signal, signame), on_shutdown, self._client)
        else: # Win case
           # If we have windows we need to wake up all the time so we can quit
            def wakeup():
                # Call again
                loop.call_later(0.4, wakeup)
            loop.call_later(0.4, wakeup)

        try:
            future = asyncio.Future()
            asyncio.async(self.connect(future))
            loop.run_forever()
        except:
            _log.debug(traceback.format_exc())
            asyncio.wait_for(future, 20)
            if _platform is 'win32': # Windows case 
                loop.call_soon(on_shutdown, self._client)
                asyncio.wait_for(future, 20)
                loop.run_forever()
            else: # *ix case
                 asyncio.wait_for(future, 20)
            _log.debug("Done")

I guess this can improve a lot but it works and have quirks for windows also.

/R