code: def _create_pymoo_problem(
      optimizer: base.Optimizer,
      objective_function: tp.Callable[[tp.ArrayLike], float],
      elementwise: bool = True,
  ):
      kwargs = {}
      try:
          # pylint:disable=import-outside-toplevel
          from pymoo.core.problem import ElementwiseProblem, Problem  # type: ignore
  
          Base = ElementwiseProblem if elementwise else Problem
      except ImportError:
          # Used if pymoo < 0.5.0
          # pylint:disable=import-outside-toplevel
          from pymoo.model.problem import Problem as Base  # type: ignore
  
          kwargs = {"elementwise_evaluation": elementwise}
  
      class _PymooProblem(Base):  # type: ignore
          def __init__(self, optimizer, objective_function):
              self.objective_function = objective_function
              super().__init__(
                  n_var=optimizer.dimension,
                  n_obj=optimizer.num_objectives,
                  n_constr=0,  # constraints handled already by nevergrad
                  xl=-math.pi * 0.5,
                  xu=math.pi * 0.5,
                  **kwargs,
              )
  
          def _evaluate(self, X, out, *args, **kwargs):
              # pylint:disable=unused-argument
              # pymoo is supplying us with bounded parameters in [-pi/2,pi/2]. Nevergrad wants unbounded reals from us.
              out["F"] = self.objective_function(np.tan(X))
  
      return _PymooProblem(optimizer, objective_function)
  
imports: import functools
  import math
  import warnings
  import weakref
  import numpy
  from scipy import optimize
  import nevergrad.common.typing
  from nevergrad.parametrization import parameter
  from nevergrad.common import errors
  from .None import base
  from .base import IntOrParameter
  from .None import recaster
label_desc: Use image node_id 1 for calling a global function with example usage: _create_pymoo_problem(optimizer, objective_function, elementwise) and returns: _PymooProblem