Python wrapper for resid