docs: def set_lexer_from_filename(self, filename):
          """
          Change the lexer based on the filename (actually only the extension is
          needed)
  
          :param filename: Filename or extension
          """
          self._lexer = None
          if filename.endswith("~"):
              filename = filename[0:len(filename) - 1]
          try:
              self._lexer = get_lexer_for_filename(filename)
          except (ClassNotFound, ImportError):
              print('class not found for url', filename)
              try:
                  m = mimetypes.guess_type(filename)
                  print(m)
                  self._lexer = get_lexer_for_mimetype(m[0])
              except (ClassNotFound, IndexError, ImportError):
                  self._lexer = get_lexer_for_mimetype('text/plain')
          if self._lexer is None:
              _logger().warning('failed to get lexer from filename: %s, using '
                                'plain text instead...', filename)
              self._lexer = TextLexer()