def mimic(self, target):
        if self._max_objectives > 0 and \
           len(target._objectives) > self._max_objectives:
            self.parent.raise_exception("This driver allows a maximum of %d"
                                        " objectives, but the driver being"
                                        " replaced has %d" %
                                        (self._max_objectives,
                                         len(target._objectives)),
                                        RuntimeError)
        self.clear_objectives()
        for name, obj in target._objectives.items():
            self.add_objective(obj.text, name=name, scope=obj.scope)
Copy what objectives we can from the target.
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/hasobjective.py/HasObjectives.mimic