code: def find_lexer_for_filename(filename):
      
      filename = filename or ''
      root, ext = os.path.splitext(filename)
      if ext in custom_extension_lexer_mapping:
          lexer = get_lexer_by_name(custom_extension_lexer_mapping[ext])
      else:
          try:
              lexer = get_lexer_for_filename(filename)
          except Exception:
              return TextLexer()
      return lexer
docs: Get a Pygments Lexer given a filename.