def is_optional(cls: GenericType) -> bool:
    """Check if a class is an Optional.

    Args:
        cls: The class to check.

    Returns:
        Whether the class is an Optional.
    """
    return (
        cls is None
        or cls is type(None)
        or (is_union(cls) and type(None) in get_args(cls))
    )
Check if a class is an Optional.

    Args:
        cls: The class to check.

    Returns:
        Whether the class is an Optional.
    
reflex/utils/types.py