def _strat_has_unitary_from_has_unitary(val: Any) -> bool | None:
    """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
Attempts to infer a value's unitary-ness via its _has_unitary_ method.
cirq-core/cirq/protocols/has_unitary_protocol.py