parameters: (self, src, language)
return_statement: return lexer
docstring: Get the Pygments lexer.
docstring_summary: Get the Pygments lexer.
docstring_tokens: Get the Pygments lexer .
function: def get_lexer(self, src, language):
          """Get the Pygments lexer."""
  
          if language:
              language, lexer_options = self.get_extended_language(language)
          else:
              lexer_options = {}
  
          # Try and get lexer by the name given.
          try:
              lexer = get_lexer_by_name(language, **lexer_options)
          except Exception:
              lexer = None
  
          if lexer is None:
              if self.guess_lang:
                  try:
                      lexer = guess_lexer(src)
                  except Exception:  # pragma: no cover
                      pass
          if lexer is None:
              lexer = get_lexer_by_name('text')
          return lexer
function_tokens: def get_lexer ( self , src , language ) : if language : language , lexer_options = self . get_extended_language ( language ) else : lexer_options = { } # Try and get lexer by the name given. try : lexer = get_lexer_by_name ( language , * * lexer_options ) except Exception : lexer = None if lexer is None : if self . guess_lang : try : lexer = guess_lexer ( src ) except Exception : # pragma: no cover pass if lexer is None : lexer = get_lexer_by_name ( 'text' ) return lexer