Refactor python generator
Fix gen_call