def _strat_has_unitary_from_unitary(val: Any) -> bool | None:
    """Attempts to infer a value's unitary-ness via its _unitary_ method."""
    getter = getattr(val, '_unitary_', None)
    if getter is None:
        return None
    result = getter()
    return result is not NotImplemented and result is not None
Attempts to infer a value's unitary-ness via its _unitary_ method.
cirq-core/cirq/protocols/has_unitary_protocol.py