<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply(self, func, *args, cont=False, tag=None, **kwargs):
 """Apply `func` to both sides of the equation Returns a new equation where the left-hand-side and right-hand side are replaced by the application of `func`:: lhs=func(lhs, *args, **kwargs) rhs=func(rhs, *args, **kwargs) If ``cont=True``, the resulting equation will keep a history of its previous state (resulting in multiple lines of equations when printed, as in the main example above). The resulting equation with have the given `tag`. """

        new_lhs = func(self.lhs, *args, **kwargs)
        if new_lhs == self.lhs and cont:
            new_lhs = None
        new_rhs = func(self.rhs, *args, **kwargs)
        new_tag = tag
        return self._update(new_lhs, new_rhs, new_tag, cont)