compatible with python 2.4,2.7,3.3