def _snake_to_upper_camel(snake: str) -> str:
    """Convert snake to upper camel, ignoring start/end underscores."""
    if not snake:
        return snake
    snake = snake.lower()
    camel = ''
    lift = True
    for s in snake:
        if s == '_':
            lift = True
            continue
        if lift:
            camel = camel + s.upper()
            lift = False
        else:
            camel = camel + s
    return camel