def wait(self, timeout=0):
        """Wait until the corouine is finished or return after timeout seconds.
        This is achieved by running the GTK+ main loop.
        """
        clock = time.clock
        start_time = clock()
        main = gobject.main_context_default()
        while self.is_alive():
            main.iteration(False)
            if timeout and (clock() - start_time >= timeout):
                return
Wait until the corouine is finished or return after timeout seconds.
        This is achieved by running the GTK+ main loop.
        
recipes/Python/327082_Pseudo_threads_generators/recipe-327082.py