import string


def camel_to_snake(s: str) -> str:
    """Returns a new str in snake_case, given an str in camelCase.

    Raises:
        ValueError: When original str is not in camelCase

    Examples:
        >>> camel_to_snake('camelToSnake')
        'camel_to_snake'
        >>> camel_to_snake('already_snake')
        Traceback (most recent call last):
          ...
        ValueError: original str is not in camelCase: 'already_snake'
        >>> camel_to_snake('lonecamel')
        'lonecamel'
        >>> camel_to_snake('CapWords')
        'cap_words'
        >>> camel_to_snake('Ugly_Case')
        Traceback (most recent call last):
          ...
        ValueError: original str is not in camelCase: 'Ugly_Case'
    """
    if '_' in s:
        raise ValueError("original str is not in camelCase: '{}'".format(s))
    for u in string.ascii_uppercase:
        s = s.replace(u, '_' + u.lower())
    if s.startswith('_'):
        # _cap_words
        return s[1:]
    return s