ok, then I guess it can stay as is but put `function = sympify(function)` before what you have done and then you won't need to check for the attribute and the sympyification in the `piecewise_fold` statement can be removed.