'Given a regular expression match from `_EXAMPLE_RE` (`m`),
return a pair `(source, want)`, where `source` is the matched
example\'s source code (with prompts and indentation stripped);
and `want` is the example\'s expected output (with indentation
stripped).
`name` is the string\'s name, and `lineno` is the line number
where the example starts; both are used for error messages.
>>> def parseit(s):
...     p = LongFormDocTestParser()
...     return p._parse_example(p._EXAMPLE_RE.search(s), \'<string>\', 1)
>>> parseit(\'>>> 1\n1\')
(\'1\', {}, \'1\', None)
>>> parseit(\'>>> (1\n... +1)\n2\')
(\'(1\n+1)\', {}, \'2\', None)
>>> parseit(\'.. run:\n\n    test1\n    test2\n\')
(\'test1\ntest2\', {}, \'\', None)'

def _parse_example(self, m, name, lineno):

    runner = (m.group('run') or '')
    indent = len(m.group(('%sindent' % runner)))
    source_lines = m.group(('%ssource' % runner)).split('\n')
    if runner:
        self._check_prefix(source_lines[1:], ('    ' * indent), name, lineno)
    else:
        self._check_prompt_blank(source_lines, indent, name, lineno)
        self._check_prefix(source_lines[2:], (('    ' * indent) + '.'), name, lineno)
    if runner:
        source = '\n'.join([sl[indent:] for sl in source_lines])
    else:
        source = '\n'.join([sl[(indent + 4):] for sl in source_lines])
    if runner:
        want = ''
        exc_msg = None
    else:
        want = m.group('want')
        want_lines = want.split('\n')
        if ((len(want_lines) > 1) and re.match('    *$', want_lines[(-1)])):
            del want_lines[(-1)]
        self._check_prefix(want_lines, ('    ' * indent), name, (lineno + len(source_lines)))
        want = '\n'.join([wl[indent:] for wl in want_lines])
        m = self._EXCEPTION_RE.match(want)
        if m:
            exc_msg = m.group('msg')
        else:
            exc_msg = None
    options = self._find_options(source, name, lineno)
    return (source, options, want, exc_msg)
