def is_optional(annotation: type) -> bool:
    """Returns True if the annotation is Optional[SomeType]."""
    # Optionals are represented as unions

    if not is_union(annotation):
        return False

    types = annotation.__args__  # type: ignore[attr-defined]

    # A Union to be optional needs to have at least one None type
    return any(x == None.__class__ for x in types)
Returns True if the annotation is Optional[SomeType].
strawberry/utils/typing.py