def METHOD_NAME(protocol, args, key, gate):
    if protocol:
        gate_with_key = protocol(gate, args)
    else:
        gate_with_key = gate.with_key('b')
    assert gate_with_key.key == key
    assert gate_with_key.num_qubits() == gate.num_qubits()
    assert gate_with_key.observable() == gate.observable()
    assert cirq.qid_shape(gate_with_key) == cirq.qid_shape(gate)
    if protocol:
        same_gate = cirq.with_measurement_key_mapping(gate, {'a': 'a'})
    else:
        same_gate = gate.with_key('a')
    assert same_gate == gate