def sanitize_name(raw_value):
 value = force_text(raw_value)
 value = unicodedata.normalize('NFKC', value)
 value = re.sub('[^\\w\\s._-]', '', value, flags=re.U).strip()
 return mark_safe(re.sub('[-\\s]+', '-', value, flags=re.U))

def sanitize_name ( raw_value ) : value = force_text ( raw_value ) value = unicodedata . normalize ( 'NFKC' , value ) value = re . sub ( '[^\\w\\s._-]' , '' , value , flags = re . U ) . strip ( ) return mark_safe ( re . sub ( '[-\\s]+' , '-' , value , flags = re . U ) )
sanitizes a value to be safe to store in a linux filesystem .