def read_until_regexp(self, *expected):
        """Reads from the current output, until a match to a regexp in expected.

        Expected is a list of regular expression patterns as strings,
        or compiled regular expressions. The keyword returns the text
        up to and including the first match to any of the regular
        expressions.

        If the last argument in `*expected` is a valid log level, it
        is used as `loglevel` in the keyword `Read`.

        Examples:
        | Read Until Regexp | (#|$) |
        | Read Until Regexp | first_regexp | second_regexp |
        | Read Until Regexp | some regexp  | DEBUG |
        """
        expected = list(expected)
        if self._is_valid_log_level(expected[-1]):
            loglevel = expected[-1]
            expected = expected[:-1]
        else:
            loglevel = 'INFO'
        try:
            index, _, ret = self.expect(expected, self._timeout)
        except __HOLE__:
            index, ret = -1, ''
        ret = ret.decode('ASCII', 'ignore')
        self._log(ret, loglevel)
        if index == -1:
            expected = [ exp if isinstance(exp, basestring) else exp.pattern
                         for exp in expected ]
            raise AssertionError("No match found for %s in %s"
                                 % (utils.seq2str(expected, lastsep=' or '),
                                    utils.secs_to_timestr(self._timeout)))
        return ret
dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/Telnet.py/TelnetConnection.read_until_regexp