code: def check_x_in_space(x, space):
      if is_2Dlistlike(x):
          if not np.all([p in space for p in x]):
              raise ValueError(
                  "Not all points are within the bounds of"
                  " the space."
              )
          if any([len(p) != len(space.dimensions) for p in x]):
              raise ValueError(
                  "Not all points have the same dimensions as"
                  " the space."
              )
      elif is_listlike(x):
          if x not in space:
              raise ValueError(
                  "Point (%s) is not within the bounds of"
                  " the space (%s)." % (x, space.bounds)
              )
          if len(x) != len(space.dimensions):
              raise ValueError(
                  "Dimensions of point (%s) and space (%s) do not match"
                  % (x, space.bounds)
              )
  
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 7 for calling a global function with example usage: check_x_in_space(x, space) without return types