from typing import Any
from typing import Optional


def _strat_has_unitary_from_has_unitary(val: Any) -> Optional[bool]:
    """Attempts to infer a value's unitary-ness via its _has_unitary_ method."""
    if hasattr(val, '_has_unitary_'):
        result = val._has_unitary_()
        if result is NotImplemented:
            return None
        return result
    return None