def METHOD_NAME(a, sigma, axis=None, mask=None, fill_value=0.0, inplace=False):
    """
    """
    abs_deviation = absolute_deviation(a, axis=axis, mask=mask)
    robust_std = robust_standard_deviation(a, axis=axis, abs_deviation=abs_deviation, mask=mask)
    if axis is not None:
        robust_std = np.expand_dims(robust_std, axis=axis)
    # Throw away any values that are N sigma from the median
    sigma_mask = abs_deviation > (sigma * robust_std)
    if mask is not None:
        sigma_mask = np.logical_or(sigma_mask, mask > 0)
    if inplace:
        mean_array = a
    else:
        mean_array = a.copy()
    mean_array[sigma_mask] = 0.0
    # Take the sigma clipped mean
    mean_values = mean_array.sum(axis=axis)
    n_good_pixels = np.logical_not(sigma_mask).sum(axis=axis)
    if axis is None:
        if n_good_pixels > 0:
            mean_values /= n_good_pixels
        else:
            mean_values = fill_value
    else:
        mean_values[n_good_pixels > 0] /= n_good_pixels[n_good_pixels > 0]
        mean_values[n_good_pixels == 0] = fill_value
    return mean_values