def build_ipy_lexer(python3):
 if python3:
  PyLexer = Python3Lexer
  name = 'IPython3'
  aliases = ['ipython3']
  doc = 'IPython3 Lexer'
 else:
  PyLexer = PythonLexer
  name = 'IPython'
  aliases = ['ipython2', 'ipython']
  doc = 'IPython Lexer'
 tokens = PyLexer.tokens.copy()
 tokens['root'] = (ipython_tokens + tokens['root'])
 attrs = {'name': name, 'aliases': aliases, 'filenames': [], '__doc__': doc, 'tokens': tokens}
 return type(name, (PyLexer,), attrs)

def build_ipy_lexer ( python3 ) : if python3 : PyLexer = Python3Lexer name = 'IPython3' aliases = [ 'ipython3' ] doc = 'IPython3 Lexer' else : PyLexer = PythonLexer name = 'IPython' aliases = [ 'ipython2' , 'ipython' ] doc = 'IPython Lexer' tokens = PyLexer . tokens . copy ( ) tokens [ 'root' ] = ( ipython_tokens + tokens [ 'root' ] ) attrs = { 'name' : name , 'aliases' : aliases , 'filenames' : [ ] , '__doc__' : doc , 'tokens' : tokens } return type ( name , ( PyLexer , ) , attrs )
builds ipython lexers depending on the value of python3 .