code: def wavefunction(self, quil_program: Program,
                       memory_map: Any = None) -> Wavefunction:
          
  
          if memory_map is not None:
              quil_program = self.augment_program_with_memory_values(quil_program, memory_map)
  
          return self.connection._wavefunction(quil_program=quil_program,
                                               random_seed=self.random_seed)
docs: Simulate a Quil program and return the wavefunction.
  
          .. note:: If your program contains measurements or noisy gates, this method may not do what
              you want. If the execution of ``quil_program`` is **non-deterministic** then the
              final wavefunction only represents a stochastically generated sample and the
              wavefunctions returned by *different* ``wavefunction`` calls *will generally be
              different*.
  
          :param quil_program: A Quil program.
          :param memory_map: An assignment of classical registers to values, representing an initial
                             state for the QAM's classical memory.
  
                             This is expected to be of type Dict[str, List[Union[int, float]]],
                             where the keys are memory region names and the values are arrays of
                             initialization data.
  
                             For now, we also support input of type Dict[MemoryReference, Any],
                             but this is deprecated and will be removed in a future release.
          :return: A Wavefunction object representing the state of the QVM.