import re


def snake_case_str(s):
    """
    Translate a string like "foo_Bar-baz  whee" and return "foo_bar_baz_whee".
    """
    return re.sub(r'([^a-z0-9]+|^)(.)', lambda m: f'{"_" if m.group(1) else ""}{m.group(2).lower()}', s, flags=re.IGNORECASE)