def wavefunction(self) -> pyquil.Wavefunction:
        """
        Return the wavefunction of a completed program.
        """
        assert self.status == 'done'
        assert self._ket is not None
        wavefn = state_to_wavefunction(self._ket)
        return wavefn
Return the wavefunction of a completed program.