def compress(lhs_label, rhs_label):
    """Combine two labels where the rhs replaces the lhs. If the rhs is
    empty, assume the lhs takes precedent."""
    if not rhs_label:
        return lhs_label
    label = list(lhs_label)
    label.extend([None] * len(rhs_label))
    label = label[:len(rhs_label)]
    for idx, rhs_part in enumerate(rhs_label):
        label[idx] = rhs_part or label[idx]
    return label
