human
Write me a the Python program you requested given the following:
Complete the below
def getMarkerOnset(filename, chunk=128, secs=0.5, marker_hz=19000, marker_duration=0.015):

    ''''Returns marker sound (onset, offset) in sec, as read from filename.'
    '''
assistant
#Here is the Python program you requested.
    def thresh2SD(data, mult=2, thr=None):
        'Return    index    of    first    value    in    abs(data)    exceeding    2    *    std(data),\n                                or    length    of    the    data    +    1    if    nothing    >    threshold\n\n                                Return    threshold    so    can    re-use    the    same    threshold    later\n                                '
        data = abs(data)
        if (not thr):
            thr = (mult * np.std(data))
        val = data[(data > thr)]
        if (not len(val)):
            return ((len(data) + 1), thr)
        first = val[0]
        for (i, v) in enumerate(data):
            if (v == first):
                return (i, thr)
    (data, sampleRate) = readWavFile(filename)
    if (marker_hz == 0):
        raise ValueError('Custom    marker    sounds    cannot    be    auto-detected.')
    if (sampleRate < (2 * marker_hz)):
        msg = 'Recording    rate    (%i    Hz)    too    slow    for    %i    Hz-based    marker    detection.'
        raise ValueError((msg % (int(sampleRate), marker_hz)))
    chunk = max(16, chunk)
    bandSize = (150 * (2 ** (8 - int(np.log2(chunk)))))
    dataToUse = data[:int((sampleRate * secs))]
    lo = max(0, (marker_hz - bandSize))
    hi = (marker_hz + bandSize)
    dftProfile = getDftBins(dataToUse, sampleRate, lo, hi, chunk)
    (onsetChunks, thr) = thresh2SD(dftProfile)
    onsetSecs = ((onsetChunks * chunk) / sampleRate)
    ratio = (chunk / sampleRate)
    start = (onsetChunks - 4)
    stop = (int((onsetChunks + (marker_duration / ratio))) + 4)
    backwards = dftProfile[max(start, 0):min(stop, len(dftProfile))]
    (offChunks, _junk) = thresh2SD(backwards[::(-1)], thr=thr)
    offSecs = (((start + len(backwards)) - offChunks) * ratio)
    return (onsetSecs, offSecs)