compatible with py2

@lxyu