code: def generate_ctrlpts2d_weights(ctrlpts2d):
      
      # Divide control points by weight
      new_ctrlpts2d = []
      for row in ctrlpts2d:
          ctrlptsw_v = []
          for col in row:
              temp = [float(c / col[-1]) for c in col]
              temp[-1] = float(col[-1])
              ctrlptsw_v.append(temp)
          new_ctrlpts2d.append(ctrlptsw_v)
  
      return new_ctrlpts2d
docs: Generates unweighted control points from weighted ones in 2-D.
  
      This function
  
      #. Takes in 2-D control points list whose coordinates are organized like (x*w, y*w, z*w, w)
      #. Converts the input control points list into (x, y, z, w) format
      #. Returns the result
  
      :param ctrlpts2d: 2-D control points (P)
      :type ctrlpts2d: list
      :return: 2-D weighted control points (Pw)
      :rtype: list