Changes the case to snake/kebab case depending on the separator.

    As regexes can be confusing, I'll just go through this line by line as an
    example with the following string: ' Foo2Boo_barBaz bat'

    1. Remove whitespaces from beginning/end. => 'Foo2Boo_barBaz bat-rat'
    2. Replace remaining spaces with underscores => 'Foo2Boo_barBaz_bat-rat'
    3. Add underscores before capital letters => 'Foo2_Boo_bar_Baz_bat-rat'
    4. Replace capital with lowercase => 'foo2_boo_bar_baz_bat-rat'
    5. Underscores & hyphens become the separator => 'foo2-boo-bar-baz-bat-rat'

    Args:
        s (str): The original string.
        separator: The separator you want to use (default '-' for kebab case).

    Returns:
        A snake_case or kebab-case (depending on separator)

def change_case(s, separator='-'):
    """Changes the case to snake/kebab case depending on the separator.

    As regexes can be confusing, I'll just go through this line by line as an
    example with the following string: ' Foo2Boo_barBaz bat'

    1. Remove whitespaces from beginning/end. => 'Foo2Boo_barBaz bat-rat'
    2. Replace remaining spaces with underscores => 'Foo2Boo_barBaz_bat-rat'
    3. Add underscores before capital letters => 'Foo2_Boo_bar_Baz_bat-rat'
    4. Replace capital with lowercase => 'foo2_boo_bar_baz_bat-rat'
    5. Underscores & hyphens become the separator => 'foo2-boo-bar-baz-bat-rat'

    Args:
        s (str): The original string.
        separator: The separator you want to use (default '-' for kebab case).

    Returns:
        A snake_case or kebab-case (depending on separator)
    """
    s = s.strip()
    no_spaces = re.sub(' ', '_', s)
    add_underscores = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', no_spaces)
    lowercase = re.sub('([a-z0-9])([A-Z])', r'\1_\2', add_underscores).lower()
    return re.sub('[-_]', separator, lowercase)