Piece-wise regression by clustering
If you use these 2 packages:

http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html

https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html

you will get what you want :)