If a defendant appears in court and pleads guilty or no contest to a crime punishable as a felony or Class 1 misdemeanor, the court shall inquire whether the defendant is currently serving in or is a veteran of, the United States Armed Forces. If the defendant is currently serving in the military or is a military veteran, the court may:
(1) Order that a court services officer consult with the United States Department of Veterans Affairs or another agency or person with suitable knowledge or experience, for the purpose of providing the court with information regarding treatment options available to the defendant, including federal, state, and local programming; and(2) Consider the treatment recommendations of any diagnosing or treating mental health or substance abuse professionals together with the treatment options available to the defendant in imposing sentence.