class_docstr: An IPython console lexer for IPython code-blocks and doctests, such as:
  
  .. code-block:: rst
  
      .. code-block:: ipythonconsole
  
          In [1]: a = 'foo'
  
          In [2]: a
          Out[2]: 'foo'
  
          In [3]: print a
          foo
  
          In [4]: 1 / 0
  
  
  Support is also provided for IPython exceptions:
  
  .. code-block:: rst
  
      .. code-block:: ipythonconsole
  
          In [1]: raise Exception
  
          ---------------------------------------------------------------------------
          Exception                                 Traceback (most recent call last)
          <ipython-input-1-fca2ab0ca76b> in <module>()
          ----> 1 raise Exception
  
          Exception:
docstr: Initialize the IPython console lexer.
  
  Parameters
  ----------
  python3 : bool
      If `True`, then the console inputs are parsed using a Python 3
      lexer. Otherwise, they are parsed using a Python 2 lexer.
  in1_regex : RegexObject
      The compiled regular expression used to detect the start
      of inputs. Although the IPython configuration setting may have a
      trailing whitespace, do not include it in the regex. If `None`,
      then the default input prompt is assumed.
  in2_regex : RegexObject
      The compiled regular expression used to detect the continuation
      of inputs. Although the IPython configuration setting may have a
      trailing whitespace, do not include it in the regex. If `None`,
      then the default input prompt is assumed.
  out_regex : RegexObject
      The compiled regular expression used to detect outputs. If `None`,
      then the default output prompt is assumed.
docstr_tok: ["Initialize","the","IPython","console","lexer",".","Parameters","--","--","--","--","--","python3",":","bool","If","`","True","`",",","then","the","console","inputs","are","parsed","using","a","Python","3","lexer",".","Otherwise",",","they","are","parsed","using","a","Python","2","lexer",".","in1_regex",":","RegexObject","The","compiled","regular","expression","used","to","detect","the","start","of","inputs",".","Although","the","IPython","configuration","setting","may","have","a","trailing","whitespace",",","do","not","include","it","in","the","regex",".","If","`","None","`",",","then","the","default","input","prompt","is","assumed",".","in2_regex",":","RegexObject","The","compiled","regular","expression","used","to","detect","the","continuation","of","inputs",".","Although","the","IPython","configuration","setting","may","have","a","trailing","whitespace",",","do","not","include","it","in","the","regex",".","If","`","None","`",",","then","the","default","input","prompt","is","assumed",".","out_regex",":","RegexObject","The","compiled","regular","expression","used","to","detect","outputs",".","If","`","None","`",",","then","the","default","output","prompt","is","assumed","."]
code: def __init__(self, **options):
      """Initialize the IPython console lexer.
  
      Parameters
      ----------
      python3 : bool
          If `True`, then the console inputs are parsed using a Python 3
          lexer. Otherwise, they are parsed using a Python 2 lexer.
      in1_regex : RegexObject
          The compiled regular expression used to detect the start
          of inputs. Although the IPython configuration setting may have a
          trailing whitespace, do not include it in the regex. If `None`,
          then the default input prompt is assumed.
      in2_regex : RegexObject
          The compiled regular expression used to detect the continuation
          of inputs. Although the IPython configuration setting may have a
          trailing whitespace, do not include it in the regex. If `None`,
          then the default input prompt is assumed.
      out_regex : RegexObject
          The compiled regular expression used to detect outputs. If `None`,
          then the default output prompt is assumed.
  
      """
      self.python3 = get_bool_opt(options, "python3", False)
      if self.python3:
          self.aliases = ["ipython3console"]
      else:
          self.aliases = ["ipython2console", "ipythonconsole"]
  
      in1_regex = options.get("in1_regex", self.in1_regex)
      in2_regex = options.get("in2_regex", self.in2_regex)
      out_regex = options.get("out_regex", self.out_regex)
  
      # So that we can work with input and output prompts which have been
      # rstrip'd (possibly by editors) we also need rstrip'd variants. If
      # we do not do this, then such prompts will be tagged as 'output'.
      # The reason can't just use the rstrip'd variants instead is because
      # we want any whitespace associated with the prompt to be inserted
      # with the token. This allows formatted code to be modified so as hide
      # the appearance of prompts, with the whitespace included. One example
      # use of this is in copybutton.js from the standard lib Python docs.
      in1_regex_rstrip = in1_regex.rstrip() + "\n"
      in2_regex_rstrip = in2_regex.rstrip() + "\n"
      out_regex_rstrip = out_regex.rstrip() + "\n"
  
      # Compile and save them all.
      attrs = [
          "in1_regex",
          "in2_regex",
          "out_regex",
          "in1_regex_rstrip",
          "in2_regex_rstrip",
          "out_regex_rstrip",
      ]
      for attr in attrs:
          self.__setattr__(attr, re.compile(locals()[attr]))
  
      Lexer.__init__(self, **options)
  
      if self.python3:
          pylexer = IPython3Lexer
          tblexer = IPythonTracebackLexer
      else:
          pylexer = IPythonLexer
          tblexer = IPythonTracebackLexer
  
      self.pylexer = pylexer(**options)
      self.tblexer = tblexer(**options)
  
      self.reset()
  
imports: import re
  from pygments.lexers import BashLexer, Python3Lexer
  from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using
  from pygments.token import Generic, Keyword, Literal, Name, Operator, Other, Text, Error
  from pygments.util import get_bool_opt
label_desc: Use image node_id 1 to create a new IPythonConsoleLexer object from inherited base classes: Lexer with example: obj = IPythonConsoleLexer()