def slugify(value):
<EOL>value = Markup(value).striptags()<EOL>if type(value) == unicode:<EOL><INDENT>value = unicode(unidecode(value))<EOL>value = unicodedata.normalize('<STR_LIT>', value).encode('<STR_LIT:ascii>', '<STR_LIT:ignore>')<EOL><DEDENT>value = unicode(re.sub('<STR_LIT>', '<STR_LIT>', value).strip().lower())<EOL>return re.sub('<STR_LIT>', '<STR_LIT:->', value)<EOL>
Normalizes string, converts to lowercase, removes non-alpha characters,
and converts spaces to hyphens.

Took from django sources.