def camel_to_snake(self, s):
    _underscorer1 = re.compile('(.)([A-Z][a-z]+)')
    _underscorer2 = re.compile('([a-z0-9])([A-Z])')
    subbed = _underscorer1.sub('\\1_\\2', s)
    return _underscorer2.sub('\\1_\\2', subbed).lower()
def camel_to_snake(self, s):
    _underscorer1 = re.compile('(.)([A-Z][a-z]+)')
    _underscorer2 = re.compile('([a-z0-9])([A-Z])')
    subbed = _underscorer1.sub('\\1_\\2', s)
    return _underscorer2.sub('\\1_\\2', subbed).lower()