If such treatment will require a longer period of confinement than the period for which defendant was placed in the diagnostic facility, the Director of Corrections may file with the court which placed defendant in the facility a petition for extension of the period of confinement, to which shall be attached a writing signed by defendant giving his consent to the extension. If the court finds the petition and consent in order, it may order the extension, and transmit a copy of the order to the Director of Corrections.
Ca. Pen. Code § 1203.03