def _wait_for_modem(self):
        """
        Blocks until this backend has connected to and initialized the modem,
        waiting for a maximum of self.MAX_CONNECT_TIME (default=10) seconds.
        Returns true when modem is ready, or false if it times out.
        """

        # if the modem isn't present yet, this message is probably being sent by
        # an application during startup from the main thread, before this thread
        # has connected to the modem. block for a short while before giving up.
        for n in range(0, self.MAX_CONNECT_TIME*10):
            if self.modem is not None: return True
            time.sleep(0.1)

        # timed out. we're still not connected
        # this is bad news, but not fatal, so warn
        self.warning("Timed out while waiting for modem")
        return False
dataset/ETHPy150Open rapidsms/rapidsms-core-dev/lib/rapidsms/backends/gsm.py/Backend._wait_for_modem/original