(1) Where the court finds that the offender has any chemical dependency that has contributed to his or her offense, the court may, as a condition of the sentence and subject to available resources, order the offender to participate in rehabilitative programs or otherwise to perform affirmative conduct reasonably related to the circumstances of the crime for which the offender has been convicted and reasonably necessary or beneficial to the offender and the community in rehabilitating the offender. A rehabilitative program may include a directive that the offender obtain an evaluation as to the need for chemical dependency treatment related to the use of alcohol or controlled substances, regardless of the particular substance that contributed to the commission of the offense. The court may also impose a prohibition on the use or possession of alcohol or controlled substances regardless of whether a chemical dependency evaluation is ordered.
(2) This section applies to sentences which include any term other than, or in addition to, a term of total confinement, including suspended sentences.