def is_union(cls: GenericType) -> bool:
    """Check if a class is a Union.

    Args:
        cls: The class to check.

    Returns:
        Whether the class is a Union.
    """
    origin = getattr(cls, "__origin__", None)
    if origin is Union:
        return True
    return origin is None and isinstance(cls, types.UnionType)
Check if a class is a Union.

    Args:
        cls: The class to check.

    Returns:
        Whether the class is a Union.
    
reflex/utils/types.py