code: def __init__(
      self,
      search_space: Dict[str, distributions.BaseDistribution],
      skopt_kwargs: Dict[str, Any],
  ) -> None:
      self._search_space = search_space
  
      dimensions = []
      for name, distribution in sorted(self._search_space.items()):
          if isinstance(distribution, distributions.IntDistribution):
              if distribution.log:
                  low = distribution.low - 0.5
                  high = distribution.high + 0.5
                  dimension = space.Real(low, high, prior="log-uniform")
              else:
                  count = (
                      distribution.high - distribution.low
                  ) // distribution.step
                  dimension = space.Integer(0, count)
          elif isinstance(
              distribution, distributions.CategoricalDistribution
          ):
              dimension = space.Categorical(distribution.choices)
          elif isinstance(
              distribution, distributions.FloatDistribution
          ):
              # Convert the upper bound from exclusive (optuna) to inclusive (skopt).
              if distribution.log:
                  high = np.nextafter(distribution.high, float("-inf"))
                  dimension = space.Real(
                      distribution.low, high, prior="log-uniform"
                  )
              elif distribution.step is not None:
                  count = int(
                      (distribution.high - distribution.low)
                      // distribution.step
                  )
                  dimension = space.Integer(0, count)
              else:
                  high = np.nextafter(distribution.high, float("-inf"))
                  dimension = space.Real(distribution.low, high)
          else:
              raise NotImplementedError(
                  "The distribution {} is not implemented.".format(
                      distribution
                  )
              )
  
          dimensions.append(dimension)
  
      self._optimizer = skopt.Optimizer(dimensions, **skopt_kwargs)
  
imports: import copy
  import random
  from typing import Any
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import Tuple
  import warnings
  import numpy
  import optuna
  from optuna import distributions
  from optuna import samplers
  from optuna._deprecated import deprecated_class
  from optuna._imports import try_import
  from optuna.exceptions import ExperimentalWarning
  from optuna.samplers import BaseSampler
  from optuna.search_space import IntersectionSearchSpace
  from optuna.study import Study
  from optuna.study._study_direction import StudyDirection
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
label_desc: Use image node_id 1 to create a new _Optimizer object  with example: obj = _Optimizer(search_space, skopt_kwargs)