#NEWLINE# def slugify( value , separator ) : #NEWLINE# #INDENT# ' Slugify a string, to make it URL friendly. ' #NEWLINE# value = unicodedata . normalize ( 'NFKD' , value ) . encode ( 'ascii' , 'ignore' ) #NEWLINE# value = re . sub ( '[^\\w\\s-]' , '' , value . decode ( 'ascii' ) ) . strip ( ) . lower ( ) #NEWLINE# return re . sub ( ( '[%s\\s]+' % separator ) , separator , value )