Why not replace spleen labels by liver labels, and then use the existing code? Something like nifti_data[where(nifti_data == labels_in_nifti[1])] = labels_in_nifti[0].
nifti_data[where(nifti_data == labels_in_nifti[1])] = labels_in_nifti[0]