sexp.py: various Python 3 fixes