 	(let ((cur-paren (if (match-beginning class-paren)
 			     class-paren def-paren)))
 	  (setq def-name
-		(buffer-substring (match-beginning cur-paren)
-				  (match-end  cur-paren))))
+		(buffer-substring-no-properties (match-beginning cur-paren)
+						(match-end  cur-paren))))
 	(beginning-of-line)
 	(setq cur-indent (current-indentation)))
 

	    ;; we put the last element on the index-alist on the start
	    ;; of the submethod alist so the user can still get to it.
	    (let ((save-elmt (pop index-alist)))
	      (push (cons (imenu-create-submenu-name prev-name)
			  (cons save-elmt sub-method-alist))
		    index-alist))))


    (goto-char start))

  ;; install imenu
  (make-variable-buffer-local 'imenu-create-index-function)
  (setq imenu-create-index-function
	(function imenu-example--create-python-index))
  (setq imenu-generic-expression
