different class definition to support more version of Python