def snake(s):
 s = re.sub('(?<=[^A-Z])\\B([A-Z])', ' \\1', s)
 return '_'.join(s.lower().split())

def snake ( s ) : s = re . sub ( '(?<=[^A-Z])\\B([A-Z])' , ' \\1' , s ) return '_' . join ( s . lower ( ) . split ( ) )
snake cases s .