def return_to_wet_date(wet_filter_data, wet_threshold_perc):
    max_wet_peak_mag = max(wet_filter_data[20:])
    max_wet_peak_index = find_index(wet_filter_data, max_wet_peak_mag)
    min_wet_peak_mag = min(wet_filter_data[:max_wet_peak_index])
    'Loop backwards from max flow index to beginning, to search for wet season'
    for (index, value) in enumerate(reversed(wet_filter_data[:max_wet_peak_index])):
        if (index == len((wet_filter_data[:max_wet_peak_index] - 1))):
            return None
        elif (((value - min_wet_peak_mag) / (max_wet_peak_mag - min_wet_peak_mag)) < wet_threshold_perc):
            'If value percentage falls below wet_threshold_perc'
            return_date = (max_wet_peak_index - index)
            return return_date
def return_to_wet_date(wet_filter_data, wet_threshold_perc):
    max_wet_peak_mag = max(wet_filter_data[20:])
    max_wet_peak_index = find_index(wet_filter_data, max_wet_peak_mag)
    min_wet_peak_mag = min(wet_filter_data[:max_wet_peak_index])
    'Loop backwards from max flow index to beginning, to search for wet season'
    for (index, value) in enumerate(reversed(wet_filter_data[:max_wet_peak_index])):
        if (index == len((wet_filter_data[:max_wet_peak_index] - 1))):
            return None
        elif (((value - min_wet_peak_mag) / (max_wet_peak_mag - min_wet_peak_mag)) < wet_threshold_perc):
            'If value percentage falls below wet_threshold_perc'
            return_date = (max_wet_peak_index - index)
            return return_date