#NEWLINE# def slugify( string ) : #NEWLINE# #INDENT# 'Slugifies a string.\n    Based on public domain code from https://github.com/zacharyvoase/slugify\n    and ported to deal with all kinds of python 2 and 3 strings\n    ' #NEWLINE# string = u ( string ) #NEWLINE# ascii_string = str ( unicodedata . normalize ( 'NFKD' , string ) . encode ( 'ascii' , 'ignore' ) ) #NEWLINE# no_punctuation = re . sub ( '[^\\w\\s-]' , '' , ascii_string ) . strip ( ) . lower ( ) #NEWLINE# slug = re . sub ( '[-\\s]+' , '-' , no_punctuation ) #NEWLINE# return u ( slug )