def ConvertStringToFilename(name):
 return re.sub('\\W', (lambda x: ('%%%02X' % ord(x.group(0)))), name, flags=re.UNICODE).rstrip('/')

def ConvertStringToFilename ( name ) : return re . sub ( '\\W' , ( lambda x : ( '%%%02X' % ord ( x . group ( 0 ) ) ) ) , name , flags = re . UNICODE ) . rstrip ( '/' )
converts an unicode string to a filesystem safe filename .