'Differentiate wrt x as long as x is not in the free symbols of any of
the upper or lower limits.
Sum(a*b*x, (x, 1, a)) can be differentiated wrt x or b but not `a`
since the value of the sum is discontinuous in `a`. In a case
involving a limit variable, the unevaluated derivative is returned.'

def _eval_derivative(self, x):

    if (isinstance(x, Symbol) and (x not in self.free_symbols)):
        return S.Zero
    (f, limits) = (self.function, list(self.limits))
    limit = limits.pop((-1))
    if limits:
        f = self.func(f, *limits)
    if (len(limit) == 3):
        (_, a, b) = limit
        if ((x in a.free_symbols) or (x in b.free_symbols)):
            return None
        df = Derivative(f, x, evaluate=True)
        rv = self.func(df, limit)
        return rv
    else:
        return NotImplementedError('Lower    and    upper    bound    expected.')
