code: def state_to_wavefunction(state: State) -> pyquil.Wavefunction:
      
      # TODO: qubits?
      amplitudes = state.vec.asarray()
  
      # pyQuil labels states backwards.
      amplitudes = amplitudes.transpose()
      amplitudes = amplitudes.reshape([amplitudes.size])
      return pyquil.Wavefunction(amplitudes)
docs: Convert a QuantumFlow state to a pyQuil Wavefunction