Python: general main() function