backport to python2