python 2.x fix for Object.factory