The problem of characterizing the least expensive bond portfolio that enables one to meet his/her liability to pay C dollars K years from now is dealt with in this article. Bond prices are allowed to be either overpriced or underpriced at the purchase time, while at the sale time the bonds are supposed to be fairly priced. Assuming shifts in spot rates to occur instantly after the acquisition of a bond portfolio Z and to follow fairly general type of behavior described by the condition (2), we give both necessary and sufficient conditions for Z to solve the immunization problem above. Our model is general enough to cover situations with twists in the yield curve. Making use of the KKT conditions, we explain in remark 7 why we focus on search of an optimal portfolio in the class of barbell strategies. Finally, by means of the KKT conditions we find an optimal bond portfolio which solves the immunization problem.