code: def bloch_vector_from_state_vector(state: Sequence, index: int) -> np.ndarray:
      
      rho = density_matrix_from_state_vector(state, [index])
      v = np.zeros(3, dtype=np.float32)
      v[0] = 2*np.real(rho[0][1])
      v[1] = 2*np.imag(rho[1][0])
      v[2] = np.real(rho[0][0] - rho[1][1])
  
      return v
docs: Returns the bloch vector of a qubit.
  
      Calculates the bloch vector of the qubit at index
      in the wavefunction given by state, assuming state follows
      the standard Kronecker convention of numpy.kron.
  
      Args:
          state: A sequence representing a wave function in which
              the ordering mapping to qubits follows the standard Kronecker
              convention of numpy.kron.
          index: index of qubit who's bloch vector we want to find.
              follows the standard Kronecker convention of numpy.kron.
  
      Returns:
          A length 3 numpy array representing the qubit's bloch vector.
  
      Raises:
          ValueError: if the size of state is not a power of 2.
          ValueError: if the size of the state represents more than 25 qubits.
          IndexError: if index is out of range for the number of qubits
              corresponding to the state.