def _wait(self, timeout):
        """
        Based upon an extract from threading.Condition().wait(). Immediately 
        tries to acquire the lock, and then sleeps for a period of time (going 
        1/2ms..1ms..2ms..4ms...50ms..50ms), repeating until the lock is 
        acquired or the timeout limit is reached.
        """
        endtime = time.time() + timeout
        # Initial delay of .5ms
        delay = 0.0005
        while 1:
            if self._lock.acquire(0):
                return
            # Nope, let's see if we have some time left to sleep
            remaining = endtime - time.time()
            if remaining <= 0:
                # Nope, let's break to the error
                break
            # Yes, let's increase the delay up to a maximum of 50ms, and 
            # limited to the remaining time
            delay = min(delay * 2, remaining, .05)
            time.sleep(delay)
        raise ResyncWaitTimeout
Based upon an extract from threading.Condition().wait(). Immediately 
        tries to acquire the lock, and then sleeps for a period of time (going 
        1/2ms..1ms..2ms..4ms...50ms..50ms), repeating until the lock is 
        acquired or the timeout limit is reached.