import re


def _case_convert_capital_to_snake(token: str) -> str:
    """Implements logic to convert a camel or Pascal case token to a snake case one.
    """
    # split on uppercase characters
    # this split works by inserting a space before each uppercase character, then space-splitting
    components = re.sub(r'([A-Z])', r' \1', token).split()
    return '_'.join(components).lower()