Improved Python golfed version