def _match_lines(self, lines2, match_func, match_nickname):
assert isinstance(lines2, Sequence)<EOL>lines2 = self._getlines(lines2)<EOL>lines1 = self.lines[:]<EOL>nextline = None<EOL>extralines = []<EOL>__tracebackhide__ = True<EOL>for line in lines2:<EOL><INDENT>nomatchprinted = False<EOL>while lines1:<EOL><INDENT>nextline = lines1.pop(<NUM_LIT:0>)<EOL>if line == nextline:<EOL><INDENT>self._log("<STR_LIT>", repr(line))<EOL>break<EOL><DEDENT>elif match_func(nextline, line):<EOL><INDENT>self._log("<STR_LIT>" % match_nickname, repr(line))<EOL>self._log("<STR_LIT>", repr(nextline))<EOL>break<EOL><DEDENT>else:<EOL><INDENT>if not nomatchprinted:<EOL><INDENT>self._log("<STR_LIT>", repr(line))<EOL>nomatchprinted = True<EOL><DEDENT>self._log("<STR_LIT>", repr(nextline))<EOL><DEDENT>extralines.append(nextline)<EOL><DEDENT>else:<EOL><INDENT>self._log("<STR_LIT>" % (line,))<EOL>pytest.fail(self._log_text)<EOL><DEDENT><DEDENT>
Underlying implementation of ``fnmatch_lines`` and ``re_match_lines``.

        :param list[str] lines2: list of string patterns to match. The actual
            format depends on ``match_func``
        :param match_func: a callable ``match_func(line, pattern)`` where line
            is the captured line from stdout/stderr and pattern is the matching
            pattern
        :param str match_nickname: the nickname for the match function that
            will be logged to stdout when a match occurs