#NEWLINE# def NormalizePluginNameForModuleName( pluginName ) : #NEWLINE# #INDENT# '\n\tNormalize a plugin name into a safer name for a module name.\n\t\n\t.. note:: may do a little more modifications than strictly\n\t          necessary and is not optimized for speed.\n\t' #NEWLINE# if is_py2 : #NEWLINE# #INDENT# pluginName = str ( pluginName , 'utf-8' ) #NEWLINE# #UNINDENT# if ( len ( ret ) == 0 ) : #NEWLINE# #INDENT# return '_' #NEWLINE# #UNINDENT# if pluginName [ 0 ] . isdigit ( ) : #NEWLINE# #INDENT# pluginName = ( '_' + pluginName ) #NEWLINE# #UNINDENT# ret = RE_NON_ALPHANUM . sub ( '_' , pluginName ) #NEWLINE# if is_py2 : #NEWLINE# #INDENT# ret = ret . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# return ret