def _diff_conditional(expr, base_scalar):
 new_expr = express(expr, base_scalar.system, variables=True)
 if (base_scalar in new_expr.atoms(BaseScalar)):
  return Derivative(new_expr, base_scalar)
 return S(0)

def _diff_conditional ( expr , base_scalar ) : new_expr = express ( expr , base_scalar . system , variables = True ) if ( base_scalar in new_expr . atoms ( BaseScalar ) ) : return Derivative ( new_expr , base_scalar ) return S ( 0 )
first re-expresses expr in the system that base_scalar belongs to .