code: def wavefunction_payload(quil_program, random_seed):
      
      if not isinstance(quil_program, Program):
          raise TypeError("quil_program must be a Quil program object")
  
      payload = {'type': TYPE_WAVEFUNCTION,
                 'compiled-quil': quil_program.out()}
  
      if random_seed is not None:
          payload['rng-seed'] = random_seed
  
      return payload
docs: REST payload for :py:func:`ForestConnection._wavefunction`