code: def _vectorize_distance(distance):
      """Turn 2D distance in one that can handle 1D, 2D and 3D input."""
  
      def _3D_distance(X, X2, **params):
          msg = "X and X2 must be np.ndarray, of dim 1, 2, or 3"
          if not isinstance(X, np.ndarray) or not isinstance(
              X2, np.ndarray
          ):
              raise TypeError(msg)
          if X.ndim > 3 or X2.ndim > 3 or X.ndim < 1 or X2.ndim < 1:
              raise TypeError(msg)
          if X.ndim < 3 and X2.ndim < 3:
              return distance(X, X2, **params)
          else:
              return pairwise_distance(X, X2, metric=distance, **params)
  
      return _3D_distance
  
label_desc: Use image node_id 1 for calling a global function with example usage: _vectorize_distance(distance) and returns: _3D_distance, distance, pairwise_distance