Whenever any person pleads guilty to or is found guilty of possession or attempted possession of a controlled substance or controlled substance analog under s. 961.41(3g), the court may, upon request of the person and with the consent of a treatment facility with special inpatient or outpatient programs for the treatment of drug dependent persons, allow the person to enter the treatment programs voluntarily for purposes of treatment and rehabilitation. Treatment shall be for the period the treatment facility feels is necessary and required, but shall not exceed the maximum sentence allowable unless the person consents to the continued treatment. At the end of the necessary and required treatment, with the consent of the court, the person may be released from sentence. If treatment efforts are ineffective or the person ceases to cooperate with treatment rehabilitation efforts, the person may be remanded to the court for completion of sentencing.
Wis. Stat. § 961.475