def _parse_by_pattern(self, lines, pattern):
for line in lines:<EOL><INDENT>match = pattern.match(line)<EOL>if match:<EOL><INDENT>params = match.groupdict()<EOL>if not params:<EOL><INDENT>params = match.groups()<EOL><DEDENT>yield self._create_output_from_match(params)<EOL><DEDENT><DEDENT>
Match pattern line by line and return Results.

        Use ``_create_output_from_match`` to convert pattern match groups to
        Result instances.

        Args:
            lines (iterable): Output lines to be parsed.
            pattern: Compiled pattern to match against lines.
            result_fn (function): Receive results of one match and return a
                Result.

        Return:
            generator: Result instances.