code: def get_parameterized_program(self):
          
          cost_para_programs = []
          driver_para_programs = []
  
          for idx in range(self.steps):
              cost_list = []
              driver_list = []
              for cost_pauli_sum in self.cost_ham:
                  for term in cost_pauli_sum.terms:
                      cost_list.append(exponential_map(term))
  
              for driver_pauli_sum in self.ref_ham:
                  for term in driver_pauli_sum.terms:
                      driver_list.append(exponential_map(term))
  
              cost_para_programs.append(cost_list)
              driver_para_programs.append(driver_list)
  
          def psi_ref(params):
              """
              Construct a Quil program for the vector (beta, gamma).
  
              :param params: array of 2 . p angles, betas first, then gammas
              :return: a pyquil program object
              """
              if len(params) != 2*self.steps:
                  raise ValueError("params doesn't match the number of parameters set by `steps`")
              betas = params[:self.steps]
              gammas = params[self.steps:]
  
              prog = Program()
              prog += self.ref_state_prep
              for idx in range(self.steps):
                  for fprog in cost_para_programs[idx]:
                      prog += fprog(gammas[idx])
  
                  for fprog in driver_para_programs[idx]:
                      prog += fprog(betas[idx])
  
              return prog
  
          return psi_ref
docs: Return a function that accepts parameters and returns a new Quil program.
  
          :returns: a function