def merge_func(op1, op2):
        """Artificial example where a CZ will absorb any merge-able operation."""
        for op in [op1, op2]:
            if op.gate == cirq.CZ:
                return op
        return None
Artificial example where a CZ will absorb any merge-able operation.
cirq-core/cirq/transformers/transformer_primitives_test.py