code: def dump(res, filename, store_objective=True, **kwargs):
      """
      Store an skopt optimization result into a file.
  
      Parameters
      ----------
      res : `OptimizeResult`, scipy object
          Optimization result object to be stored.
  
      filename : string or `pathlib.Path`
          The path of the file in which it is to be stored. The compression
          method corresponding to one of the supported filename extensions ('.z',
          '.gz', '.bz2', '.xz' or '.lzma') will be used automatically.
  
      store_objective : boolean, default=True
          Whether the objective function should be stored. Set `store_objective`
          to `False` if your objective function (`.specs['args']['func']`) is
          unserializable (i.e. if an exception is raised when trying to serialize
          the optimization result).
  
          Notice that if `store_objective` is set to `False`, a deep copy of the
          optimization result is created, potentially leading to performance
          problems if `res` is very large. If the objective function is not
          critical, one can delete it before calling `skopt.dump()` and thus
          avoid deep copying of `res`.
  
      **kwargs : other keyword arguments
          All other keyword arguments will be passed to `joblib.dump`.
      """
      if store_objective:
          dump_(res, filename, **kwargs)
  
      elif "func" in res.specs["args"]:
          # If the user does not want to store the objective and it is indeed
          # present in the provided object, then create a deep copy of it and
          # remove the objective function before dumping it with joblib.dump.
          res_without_func = deepcopy(res)
          del res_without_func.specs["args"]["func"]
          dump_(res_without_func, filename, **kwargs)
  
      else:
          # If the user does not want to store the objective and it is already
          # missing in the provided object, dump it without copying.
          dump_(res, filename, **kwargs)
  
imports: from copy import deepcopy
  from functools import wraps
  from sklearn.utils import check_random_state
  import numpy
  from scipy.optimize import OptimizeResult
  from scipy.optimize import minimize
  from sklearn.base import is_regressor
  from sklearn.ensemble import GradientBoostingRegressor
  from joblib import dump
  from joblib import load
  from collections import OrderedDict
  from .learning import ExtraTreesRegressor
  from .learning import GaussianProcessRegressor
  from .learning import GradientBoostingQuantileRegressor
  from .learning import RandomForestRegressor
  from .learning.gaussian_process.kernels import ConstantKernel
  from .learning.gaussian_process.kernels import HammingKernel
  from .learning.gaussian_process.kernels import Matern
  from .sampler import Sobol, Lhs, Hammersly, Halton, Grid
  from .sampler import InitialPointGenerator
  from .space import Space, Categorical, Integer, Real, Dimension
label_desc: Use image node_id 3 for calling a global function with example usage: dump(res, filename, store_objective) without return types