def _strat_commutes_from_commutes(
    v1: Any, v2: Any, *, atol: float = 1e-8
) -> bool | NotImplementedType | None:
    """Attempts to determine commutativity via the objects' _commutes_
    method."""

    for a, b in [(v1, v2), (v2, v1)]:
        getter = getattr(a, '_commutes_', None)
        if getter is None:
            continue

        val = getter(b, atol=atol)
        if val is not NotImplemented:
            return val
    return NotImplemented
Attempts to determine commutativity via the objects' _commutes_
    method.
cirq-core/cirq/protocols/commutes_protocol.py