def format_ref(ref: str) -> str:
    """Format a ref.

    Args:
        ref: The ref to format.

    Returns:
        The formatted ref.
    """
    # Replace all non-word characters with underscores.
    clean_ref = re.sub(r"[^\w]+", "_", ref)
    return f"ref_{clean_ref}"
Format a ref.

    Args:
        ref: The ref to format.

    Returns:
        The formatted ref.
    
reflex/utils/format.py