code: def _box_norm(X, bounds, method):
      """Adapter for boxcox_normmax pre and post scipy 1.7.0."""
      if _check_soft_dependencies("scipy<1.7.0", severity="none"):
          box_norm = _boxcox_normmax
          args = {"bounds": bounds}
      else:
          from scipy import optimize
          from scipy.stats import boxcox_normmax
  
          options = {"xatol": 1e-12}
  
          def optimizer(fun):
              return optimize.minimize_scalar(
                  fun, bounds=bounds, method="bounded", options=options
              )
  
          box_norm = boxcox_normmax
  
          if bounds is not None:
              args = {"optimizer": optimizer}
          else:
              args = {"brack": bounds}
  
      return box_norm(X, method=method, **args)
  
imports: import numpy
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation import is_int
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 2 for calling a global function with example usage: _box_norm(X, bounds, method) and returns: box_norm, optimize