def update_thresholds(p, th, th_lo, th_hi):
    """
    Updates values of thresholds with those suggested.
    """
    for name, thresh in [('th', th), ('th_lo', th_lo), ('th_hi', th_hi)]:
        if p[name] == -1:
            p[name] = thresh 

    return p