python version of abstract factory