Section 45. Any person who commits indecent assault and battery on a child under 14 under section 13B, indecent assault and battery on a mentally retarded person under the first paragraph of section 13F or indecent assault and battery on a person who has attained the age of 14 under section 13H may, in addition to the term of imprisonment authorized by such section, be punished by a term of community parole supervision for life to be served under the jurisdiction of the parole board, as set forth in section 133C of chapter 127. Any person who commits rape under section 22; rape of a child under 16 with force under section 22A; rape and abuse of a child under section 23; assault with intent to commit rape under section 24; assault of a child under 16 with intent to commit rape under section 24B; kidnapping a child under the age of 16 under section 26; drugging persons for sexual intercourse under section 3 of chapter 272; unnatural and lascivious acts with a child under 16 under section 35A of said chapter 272; or commits an attempt to violate any such section pursuant to section 6 of chapter 274, shall, except as provided for in section 18 of chapter 275, and in addition to the term of imprisonment authorized by such section, receive a sentence of community parole supervision for life to be served under the jurisdiction of the parole board, as set forth in section 133D of chapter 127. Any person convicted of violating section 13B, 13B1/2, 13B3/4, 13F, 13H, 22, 22A, 22B, 22C, 23, 23A, 23B, 24, 24B or 26 of this chapter or of an attempt to violate any of such sections pursuant to section 6 of chapter 274, after one or more prior convictions of indecent assault and battery, rape, assault with intent to commit rape, unnatural and lascivious acts, drugging for sex, kidnap or of any offense which is the same as or necessarily includes the same elements of said offense shall, in addition to the term of imprisonment authorized by such section, be punished by a term of community parole supervision for life, to be served under the jurisdiction of the parole board, as set forth in said section 133D of said chapter 127. The sentence of community parole supervision for life shall commence immediately upon the expiration of the term of imprisonment imposed upon such person by the court or upon such person's release from probation supervision or upon discharge from commitment to the treatment center pursuant to section 9 of chapter 123A, whichever first occurs.