refine for Python 3