Standard decomposition of CCNOT (Toffoli) gate into
    six CNOT gates (Plus Hadamard and T gates.) [Nielsen2000]_

    .. [Nielsen2000]
        M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum
        Information, Cambridge University Press (2000).

def ccnot_circuit(qubits: Qubits) -> Circuit:
    """Standard decomposition of CCNOT (Toffoli) gate into
    six CNOT gates (Plus Hadamard and T gates.) [Nielsen2000]_

    .. [Nielsen2000]
        M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum
        Information, Cambridge University Press (2000).
    """
    if len(qubits) != 3:
        raise ValueError('Expected 3 qubits')

    q0, q1, q2 = qubits

    circ = Circuit()
    circ += H(q2)
    circ += CNOT(q1, q2)
    circ += T(q2).H
    circ += CNOT(q0, q2)
    circ += T(q2)
    circ += CNOT(q1, q2)
    circ += T(q2).H
    circ += CNOT(q0, q2)
    circ += T(q1)
    circ += T(q2)
    circ += H(q2)
    circ += CNOT(q0, q1)
    circ += T(q0)
    circ += T(q1).H
    circ += CNOT(q0, q1)

    return circ