Section 12. Any court may, in placing on probation a defendant who is a drug dependent person who would benefit by treatment, impose as a condition of probation that the defendant receive treatment in a facility as an inpatient or outpatient; provided, however, that the court shall not impose such a condition of probation unless, after consulting with the facility, it determines that adequate and appropriate treatment is available. The defendant shall receive treatment at the facility for so long as the administrator of the facility deems that the defendant will benefit by treatment, but in no event shall he receive treatment at the facility for a period longer than the period of probation ordered by the court. A periodic program of urinalysis may be employed as a condition of probation to determine the drug free status of the probationer. The cost of the administration of such program shall be borne by the commonwealth. If the court requires as a condition of probation that the defendant shall reside in alcohol and drug free housing, the judge issuing the order shall require the probation officer to refer the defendant only to alcohol and drug free housing certified pursuant to section 18A of chapter 17 and the probation officer shall require the defendant to reside in housing so certified in order to satisfy such condition if such certified housing is available. If at any time during the period of treatment the defendant does not cooperate with the administrator or the probation officer, or does not conduct himself in accordance with the order or conditions of his probation, the administrator or the probation officer may make a report thereon to the court which placed him on probation, which may consider such conduct as a breach of probation.
Throughout the period of probation at a facility pursuant to this section, the administrator of said facility shall provide quarterly written reports on the progress being made in treatment by the defendant to the defendant's probation officer.