<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(self, ket: State = None) -> State: """ Apply the action of this circuit upon a state. If no initial state provided an initial zero state will be created. """

        if ket is None:
            qubits = self.qubits
            ket = zero_state(qubits=qubits)

        for elem in self.elements:
            ket = elem.run(ket)
        return ket