Tailored error correction codes for spin qubits