Convert to and from SymPy