I am trying to fit a piecewise constant function or a step function to my data in python. Is there any library or code snippet that would help me do this? I also want to kno