Factory prototype in python