# Add a vertex to the end of a Bezier curve

Can I add new a BezierSplinePoint to the start and end of a given curve in python. I'm thinking something like this:

curve = bpy.context.active_object # Some given curve with a disired shape

bpy.ops.object.editmode_toggle()
bpy.ops.curve.subdivide(number_cuts = N) # It now has +N point which DOESN'T alter the original shape. I need this.

### The rest is only pseudo-code
start_point = BezierSplinePoint(start_coordinates?) # I don't know how to create custom points
end_point   = BezierSplinePoint(start_coordinates?) # I don't know how to create custom points

curve.data.splines[0].bezier_points.add_point_at_index(start_point, index=0) # How to add thise point to the collection
curve.data.splines[0].bezier_points.add_point_at_index(end_point, index=N+1) # How to add thise point to the collection


EDIT: This post Poly / Bezier curve from a list of coordinates does pretty much what I want, but it starts the curve from scratch, where as I have most of the points already

EDIT2: This is driving me crazy! I figured that I could add points like so:

# curve is the object I try to manipulate
bp = curve.data.splines[0].bezier_points

curve.data.splines[0].bezier_points[0].co           = (1,2,3)