add compat for rsplit

Modified `rewrite_split` to do it for both `split` and `rsplit`