I am in search of the best way to \"slugify\" string what \"slug\" is, and my current solution is based on this recipe
I have changed it a little bit to:
<
You might consider changing the last line to
slug=re.sub(r'--+',r'-',slug)
since the pattern [-]+ is no different than -+, and you don't really care about matching just one hyphen, only two or more.
[-]+
-+
But, of course, this is quite minor.