Adding python solution.