def camel2snake(s):
    """Convert a camelCase name to snake_case"""
    o = ''
    lastcap = False
    for letter in s:
        lc = letter.lower()
        if not lc.isalpha():
            lastcap = True
        if lc == '-':
            lc = '_'
            lastcap = True
        elif not lc.isalpha():
            lastcap = True
        elif lc != letter:
            if not lastcap:
                o += '_'
            lastcap = True
        else:
            lastcap = False
        o += lc
    return o