class_docstr: A class used to parse strings containing doctest examples.
  
  Note: This is a version modified to properly recognize IPython input and
  convert any IPython examples into valid Python ones.
docstr: 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.
  
  Optional:
  `ip2py`: if true, filter the input via IPython to convert the syntax
  into valid python.
docstr_tok: ["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",".","Optional",":","`","ip2py","`",":","if","true",",","filter","the","input","via","IPython","to","convert","the","syntax","into","valid","python","."]
code: def _parse_example(self, m, name, lineno, ip2py=False):
      """
      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.
  
      Optional:
      `ip2py`: if true, filter the input via IPython to convert the syntax
      into valid python.
      """
  
      # Get the example's indentation level.
      indent = len(m.group("indent"))
  
      # Divide source into lines; check that they're properly
      # indented; and then strip their indentation & prompts.
      source_lines = m.group("source").split("\n")
  
      # We're using variable-length input prompts
      ps1 = m.group("ps1")
      ps2 = m.group("ps2")
      ps1_len = len(ps1)
  
      self._check_prompt_blank(
          source_lines, indent, name, lineno, ps1_len
      )
      if ps2:
          self._check_prefix(
              source_lines[1:], " " * indent + ps2, name, lineno
          )
  
      source = "\n".join(
          [sl[indent + ps1_len + 1 :] for sl in source_lines]
      )
  
      if ip2py:
          # Convert source input from IPython into valid Python syntax
          source = self.ip2py(source)
  
      # Divide want into lines; check that it's properly indented; and
      # then strip the indentation.  Spaces before the last newline should
      # be preserved, so plain rstrip() isn't good enough.
      want = m.group("want")
      want_lines = want.split("\n")
      if len(want_lines) > 1 and re.match(r" *$", want_lines[-1]):
          del want_lines[-1]  # forget final newline & spaces after it
      self._check_prefix(
          want_lines, " " * indent, name, lineno + len(source_lines)
      )
  
      # Remove ipython output prompt that might be present in the first line
      want_lines[0] = re.sub(r"Out\[\d+\]: \s*?\n?", "", want_lines[0])
  
      want = "\n".join([wl[indent:] for wl in want_lines])
  
      # If `want` contains a traceback message, then extract it.
      m = self._EXCEPTION_RE.match(want)
      if m:
          exc_msg = m.group("msg")
      else:
          exc_msg = None
  
      # Extract options from the source.
      options = self._find_options(source, name, lineno)
  
      return source, options, want, exc_msg
  
imports: import doctest
  import inspect
  import logging
  import os
  import re
  import sys
  from testpath import modified_env
  from inspect import getmodule
  from doctest import REPORTING_FLAGS, REPORT_ONLY_FIRST_FAILURE, _unittest_reportflags, DocTestRunner, _extract_future_flags, pdb, _OutputRedirectingPdb, _exception_traceback, linecache
  from nose.plugins import doctests, Plugin
  from nose.util import anyp, tolist
  from IPython.utils.py3compat import builtin_mod, PY3, getcwd
label_desc: Use image node_id 3 for calling the IPDocTestParser obj's underlying member method code with example usage: obj._parse_example(m, name, lineno, ip2py) and returns: source,  options,  want,  exc_msg