first commit of curve_utils.py

this is adapter from Brechts stackexchange answer