Python solution 6