Python Find Relative Extrema