def _wait_for(self, validator):
        time_slept = 0
        max_wait_for_connection = 20  # secs

        while True:
            try:
                if validator():
                    break
                else:
                    sys.stderr.write(
                        'Waiting for layer ... {0:.1f}s\n'.format(time_slept)
                    )
            except MaxRetryError as e:
                if time_slept >= max_wait_for_connection:
                    raise e
            except Exception as e:
                self.stop()
                raise e

            time.sleep(self.wait_interval)
            time_slept += self.wait_interval
dataset/ETHPy150Open crate/crate-python/src/crate/testing/layer.py/CrateLayer._wait_for/original