backward compatible with python 2