def apply_derivatives(indices, target):
    """Applies any number of derivatives to an Operator or OperatorSum"""
    for index in reversed(indices):
        target = target.derivative(index)
    return target