def METHOD_NAME(k, alphas=None, betas=None):
    '''Core function that computes the generalized likelihood 2
    '''
    assert isinstance(k, np.int64), 'ERROR: k must be an int'
    assert isinstance(alphas, np.ndarray), 'ERROR: alphas must be numpy arrays'
    assert isinstance(betas, np.ndarray), 'ERROR: betas must be numpy arrays'
    assert np.sum(alphas <= 0) == 0, 'ERROR: detected alpha values <=0'
    assert np.sum(betas <= 0) == 0, 'ERROR: detected beta values <=0'
    ret = poisson_gamma_mixtures.c_generalized_pg_mixture(k, alphas, betas)
    if np.isnan(ret):
        return 1.
    if not np.isfinite(ret):
        logging.debug('something fishy is happening to the return value. it is not finite')
        for a,b in zip(alphas,betas):
            logging.debug(a, b, poisson_gamma_mixtures.c_generalized_pg_mixture(k, np.array([a]),np.array([b])))
    output_value = np.NaN
    if(ret > 1e-300):
        output_value = np.log(ret)
    elif ret >= 0. and ret <= 1e-300:
        # Replace a probability of exatcly  to a small number
        # to avoid errors in logarithm
        output_value = np.log(1e-300)
    else:
        logging.debug('ERROR: running the c-based method failed.')
        logging.debug('%i\t%.5f\t%.5f\t%.5f'%(k, ret, alphas,betas))
        raise Exception
    return output_value