def _maybe_format_css_class(val: str, prefix: str = ""):
    """
    Create a CSS class name for the given string if it is safe to do so.

    Otherwise return nothing
    """
    if val.replace("-", "_").isidentifier():
        return f"{prefix}{val}"
    return ""