def normalize_name(name):
 new = re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', name)
 return new.lower().strip('_')

def normalize_name ( name ) : new = re . sub ( '(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))' , '_\\1' , name ) return new . lower ( ) . strip ( '_' )
normalize a python package name a la pep 503 .