code: def maximize(self,
                   init_points=5,
                   n_iter=25,
                   acq='ucb',
                   kappa=2.576,
                   xi=0.0,
                   **gp_params):
          
          self._prime_subscriptions()
          self.dispatch(Events.OPTMIZATION_START)
          self._prime_queue(init_points)
          self.set_gp_params(**gp_params)
  
          util = UtilityFunction(kind=acq, kappa=kappa, xi=xi)
          iteration = 0
          while not self._queue.empty or iteration < n_iter:
              try:
                  x_probe = next(self._queue)
              except StopIteration:
                  x_probe = self.suggest(util)
                  iteration += 1
  
              self.probe(x_probe, lazy=False)
  
          self.dispatch(Events.OPTMIZATION_END)
docs: Mazimize your function