code: def w_state(qubits: Union[int, Qubits]) -> State:
      
      N, qubits = qubits_count_tuple(qubits)
      ket = np.zeros(shape=[2] * N)
      for n in range(N):
          idx = np.zeros(shape=N, dtype=int)
          idx[n] += 1
          ket[tuple(idx)] = 1 / sqrt(N)
      return State(ket, qubits)
docs: Return a W state on N qubits