code: def combine_ctrlpts_weights(ctrlpts, weights=None):
      
      if weights is None:
          weights = [1.0 for _ in range(len(ctrlpts))]
  
      ctrlptsw = []
      for pt, w in zip(ctrlpts, weights):
          temp = [float(c * w) for c in pt]
          temp.append(float(w))
          ctrlptsw.append(temp)
  
      return ctrlptsw
docs: Multiplies control points by the weights to generate weighted control points.
  
      This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
  
      The ``weights`` function parameter can be set to None to let the function generate a weights vector composed of
      1.0 values. This feature can be used to convert B-Spline basis to NURBS basis.
  
      :param ctrlpts: unweighted control points
      :type ctrlpts: list, tuple
      :param weights: weights vector; if set to None, a weights vector of 1.0s will be automatically generated
      :type weights: list, tuple or None
      :return: weighted control points
      :rtype: list