'Apply ``self`` to the object ``obj``, where the generator is ``op``.
>>> from sympy.simplify.hyperexpand import Operator
>>> from sympy.polys.polytools import Poly
>>> from sympy.abc import x, y, z
>>> op = Operator()
>>> op._poly = Poly(x**2 + z*x + y, x)
>>> op.apply(z**7, lambda f: f.diff(z))
y*z**7 + 7*z**7 + 42*z**5'

def apply(self, obj, op):

    coeffs = self._poly.all_coeffs()
    coeffs.reverse()
    diffs = [obj]
    for c in coeffs[1:]:
        diffs.append(op(diffs[(-1)]))
    r = (coeffs[0] * diffs[0])
    for (c, d) in zip(coeffs[1:], diffs[1:]):
        r += (c * d)
    return r
