import re


def decamelize(s):
    """Decamelize the string ``s``.

    For example, ``MyBaseClass`` will be converted to ``my_base_class``.
    """

    if not isinstance(s, str):
        raise TypeError('decamelize() requires a string argument')

    if not s:
        return ''

    return re.sub(r'([a-z])([A-Z])', r'\1_\2', s).lower()