def filtermarkedaccelerators(str1, acceptlist=None): """modifies the accelerators in str1 marked with a given marker, using a given filter""" acclocs, badlocs = decoration.findaccelerators(str1, accelmarker, acceptlist) fstr1, pos = "", 0 for accelstart, accelerator in acclocs: fstr1 += str1[pos:accelstart] fstr1 += accelerator pos = accelstart + accelmarkerlen + len(accelerator) fstr1 += str1[pos:] return fstr1