Generalize for Python 2