def snakify(name, sep='_'):
 name = re.sub('([A-Z]+)([A-Z][a-z])', ('\\1%s\\2' % sep), name)
 name = re.sub('([a-z\\d])([A-Z])', ('\\1%s\\2' % sep), name)
 return name.lower()

def snakify ( name , sep = '_' ) : name = re . sub ( '([A-Z]+)([A-Z][a-z])' , ( '\\1%s\\2' % sep ) , name ) name = re . sub ( '([a-z\\d])([A-Z])' , ( '\\1%s\\2' % sep ) , name ) return name . lower ( )
convert camelcase to snake_case .