def read_until(self, until, blksize=4096, timeout=None, flags=0):
        if not isinstance(until, re._pattern_type):
            until = re.compile(until, flags)
        got = self.readbuf
        self.readbuf = ''
        with timing_out(timeout):
            while True:
                val = self.read(blksize)
                cqlshlog.debug("read %r from subproc" % (val,))
                if val == '':
                    raise EOFError("'until' pattern %r not found" % (until.pattern,))
                got += val
                m = until.search(got)
                if m is not None:
                    self.readbuf = got[m.end():]
                    got = got[:m.end()]
                    return got
dataset/ETHPy150Open francelabs/datafari/cassandra/pylib/cqlshlib/test/run_cqlsh.py/ProcRunner.read_until/original