def METHOD_NAME(self, 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.METHOD_NAME(document)