<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def funnel_rebuild(psg_trm_spec):
 """Rebuilds a model and compares it to a reference model. Parameters psg_trm: (([float], float, int), AMPAL, specification) A tuple containing the parameters, score and generation for a model as well as a model of the best scoring parameters. Returns ------- energy_rmsd_gen: (float, float, int) A triple containing the BUFF score, RMSD to the top model and generation of a model generated during the minimisation. """

        param_score_gen, top_result_model, specification = psg_trm_spec
        params, score, gen = param_score_gen
        model = specification(*params)
        rmsd = top_result_model.rmsd(model)
        return rmsd, score, gen