Section 32A. A prisoner of a correctional institution, jail or house of correction that has a gender identity, as defined in section 7 of chapter 4, that differs from the prisoner's sex assigned at birth, with or without a diagnosis of gender dysphoria or any other physical or mental health diagnosis, shall be: (i) addressed in a manner consistent with the prisoner's gender identity; (ii) provided with access to commissary items, clothing, programming, educational materials and personal property that is consistent with the prisoner's gender identity; (iii) searched by an officer of the same gender identity if the search requires an inmate to remove all clothing or includes a visual inspection of the anal cavity or genitals; provided, however, that the officer's gender identity shall be consistent with the prisoner's request; and provided further, that such search shall not be conducted for the sole purpose of determining genital status; and (iv) housed in a correctional facility with inmates with the same gender identity; provided further, that the placement shall be consistent with the prisoner's request, unless the commissioner, the sheriff or a designee of the commissioner or sheriff certifies in writing that the particular placement would not ensure the prisoner's health or safety or that the placement would present management or security problems.