'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.'

def __init__(self, **options):

    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)
    in1_regex_rstrip = (in1_regex.rstrip() + '\n')
    in2_regex_rstrip = (in2_regex.rstrip() + '\n')
    out_regex_rstrip = (out_regex.rstrip() + '\n')
    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()
