human
What is a the Python code you requested given the following:
Complete the below
def fitbinned(distfn, freq, binedges, start, fixed=None):

    ''''estimate parameters of distribution function for binned data using MLE
    Parameters
    distfn : distribution instance
    needs to have cdf method, as in scipy.stats
    freq : array, 1d
    frequency count, e.g. obtained by histogram
    binedges : array, 1d
    binedges including lower and upper bound
    start : tuple or array_like ?
    starting values, needs to have correct length
    Returns
    paramest : array
    estimated parameters
    Notes
    todo: add fixed parameter option
    added factorial'
    '''
assistant
#Here is the Python code you requested.
    if (not (fixed is None)):
        raise NotImplementedError
    nobs = np.sum(freq)
    lnnobsfact = special.gammaln((nobs + 1))
    def nloglike(params):
        'negative    loglikelihood    function    of    binned    data\n\n                                corresponds    to    multinomial\n                                '
        prob = np.diff(distfn.cdf(binedges, *params))
        return (- (lnnobsfact + np.sum(((freq * np.log(prob)) - special.gammaln((freq + 1))))))
    return optimize.fmin(nloglike, start)