class_docstr: Wrapper around PythonLexer and BashLexer.
class_docstr_tok: ["Wrapper","around","PythonLexer","and","BashLexer","."]
code: def lex_document(self, cli, document):
      text = document.text.lstrip()
  
      lexer = self.python_lexer
  
      if text.startswith("!") or text.startswith("%%bash"):
          lexer = self.shell_lexer
  
      elif text.startswith("%%"):
          for magic, l in self.magic_lexers.items():
              if text.startswith("%%" + magic):
                  lexer = l
                  break
  
      return lexer.lex_document(cli, document)
  
file_path: catboost/contrib/python/ipython/py2/IPython/terminal/ptutils.py
imports: import unicodedata
  from wcwidth import wcwidth
  from IPython.utils.py3compat import PY3
  from IPython.core.completer import IPCompleter
  from prompt_toolkit.completion import Completer, Completion
  from prompt_toolkit.layout.lexers import Lexer
  from prompt_toolkit.layout.lexers import PygmentsLexer
  import pygments.lexers
label_desc: Use image node_id 2 for calling the IPythonPTLexer obj's underlying member method code with example usage: obj.lex_document(cli, document) and returns: lexer