def METHOD_NAME(img, percentile=99.9):
    """
    Threshold an image to reduce bright spots
    :param img: (CHANGE) numpy array of image data
    :param percentile: cutoff used to threshold image
    :return: np.array: thresholded version of input image
    """
    # non_zero_vals = img[np.nonzero(img)]
    non_zero_vals = img[img > 0]
    # only threshold if channel isn't blank
    if len(non_zero_vals) > 0:
        img_max = np.percentile(non_zero_vals, percentile)
        # threshold values down to max
        threshold_mask = img > img_max
        img[threshold_mask] = img_max
    return img