<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def peaks(x, y, lookahead=20, delta=0.00003):
 """ A wrapper around peakdetect to pack the return values in a nicer format """

    _max, _min = peakdetect(y, x, lookahead, delta)
    x_peaks = [p[0] for p in _max]
    y_peaks = [p[1] for p in _max]
    x_valleys = [p[0] for p in _min]
    y_valleys = [p[1] for p in _min]
    
    _peaks = [x_peaks, y_peaks]
    _valleys = [x_valleys, y_valleys]
    return {"peaks": _peaks, "valleys": _valleys}