code: def _optimize(
      _data: Tuple[tf.Variable, tf.Variable]
  ) -> Callable[[GPModel], None]:
      def optimize(model: GPModel) -> None:
          gpflow.optimizers.Scipy().minimize(
              training_loss_closure(model, _data, compile=_COMPILE),
              variables=model.trainable_variables,
              options=dict(maxiter=_MAXITER),
              method="BFGS",
              compile=_COMPILE,
          )
  
      return optimize
  
imports: from typing import Any, Callable, DefaultDict, Generic, Iterator, List, Set, Tuple, Type, TypeVar, cast
  import numpy
  import pytest
  import tensorflow
  from _pytest.fixtures import SubRequest
  from check_shapes import check_shapes
  import gpflow
  from gpflow.base import RegressionData
  from gpflow.config import default_float
  from gpflow.inducing_variables import InducingPoints, InducingVariables
  from gpflow.kernels import Kernel, Matern52
  from gpflow.likelihoods import Exponential, Likelihood
  from gpflow.models import GPR, SGPR, SVGP, VGP, GPModel, training_loss_closure
  from gpflow.models.vgp import update_vgp_data
  from gpflow.posteriors import AbstractPosterior, PrecomputeCacheType
label_desc: Use image node_id 21 for calling a global function with example usage: _optimize(_data) and returns: optimize