Python generic framework