<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def no_spikes(tolerance):
 """ Arg ``tolerance`` is the number of spiky samples allowed. """

    def no_spikes(curve):
        diff = np.abs(curve - curve.despike())
        return np.count_nonzero(diff) < tolerance
    return no_spikes