def _wait_for_modem(self):

        # 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
Flush unsaved counter values.
dataset/ETHPy150Open rapidsms/rapidsms-core-dev/lib/rapidsms/backends/gsm.py/Backend._wait_for_modem--crossover with--dataset/ETHPy150Open livid/v2ex/mapreduce/context.py/Counters.flush