#set the current part to cp
cp = CurrentPart()
# 5 x,y points in data for closed spline last pair has to have the same values as first pair
data = [1,3,4,5,8,4,7,3,1,3]
# add a sketch named Curve on XYPlane / result will be named as curvesketch
curvesketch = cp.AddSketch('Curve', cp.XYPlane)
# add a BSline to the curvesketch using data
curvesketch.AddBspline(data,0)