def _get_clean_filename(self, f):

        filename, fileext = os.path.splitext(f)

        if not fileext in TaggerUtils.FILE_TYPE and not fileext in [".m3u", ".nfo"]:
            logger.debug("fileext: %s" % fileext)
            filename = f
            fileext = ""

        a = unicode(filename, "utf-8")

        for k, v in self.char_exceptions.iteritems():
            a = a.replace(k, v)

        a = normalize("NFKD", a).encode("ascii", "ignore")

        cf = re.compile(r"[^-\w.\(\)_]")
        cf = cf.sub("", str(a))

        cf = cf.replace(" ", "_")
        cf = cf.replace("__", "_")
        cf = cf.replace("_-_", "-")

        return "%s%s" % (cf, fileext)
Removes unwanted characters from file names
dataset/ETHPy150Open jesseward/discogstagger/discogstagger/taggerutils.py/TaggerUtils._get_clean_filename