def METHOD_NAME(beta, cmag, cyear, end_year):
    '''
    Gets the Weichert adjustment factor for each the magnitude bins
    :param float beta:
        Beta value of Gutenberg & Richter parameter (b * log(10.))
    :param np.ndarray cmag:
        Magnitude values of the completeness table
    :param np.ndarray cyear:
        Year values of the completeness table
    :param float end_year:
        Last year for consideration in the catalogue
    :returns:
        Weichert adjustment factor (float)
    '''
    if len(cmag) > 1:
        # cval corresponds to the mid-point of the completeness bins
        # In the original code it requires that the magnitude bins be
        # equal sizedclass IsotropicGaussian(BaseSmoothingKernel):
        dmag = (cmag[1:] + cmag[:-1]) / 2.
        cval = np.hstack([dmag, cmag[-1] + (dmag[-1] - cmag[-2])])
    else:
        # Single completeness value so Weichert factor is unity
        return 1.0 / (end_year - cyear[0] + 1), None
    t_f = sum(np.exp(-beta * cval)) / sum((end_year - cyear + 1) *
                                          np.exp(-beta * cval))
    return t_f, cval