merge python solution