<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generic_fit(fqdn, result, scorer, yP=None, *argl, **argd):
 """Performs the generic fit tests that are common to both classifier and regressor; uses `scorer` to score the predicted values given by the machine when tested against its training set. Args: scorer (function):
 called on the result of `machine.predict(Xtrain, ytrain)`. """

    out = None
    if len(argl) > 0:
        machine = argl[0]
        out = {}
        if hasattr(machine, "best_score_"):
            out["score"] = machine.best_score_
            
        #With fitting it is often useful to know how well the fitting set was
        #matched (by trying to predict a score on it). We can do this
        #automatically and show the result to the user.
        yL = _do_auto_predict(*argl[0:2])
        yscore = scorer(fqdn, yL, yP, *argl, **argd)
        if yscore is not None:
            out.update(yscore)

    return out