§17. Mistake of law
Ignorance of the provision of this Code or of any criminal statute is not a defense to any criminal prosecution. However, mistake of law which results in the lack of an intention that consequences which are criminal shall follow, is a defense to a criminal prosecution under the following circumstances:
(1) Where the offender reasonably relied on the act of the legislature in repealing an existing criminal provision, or in otherwise purporting to make the offender's conduct lawful; or
(2) Where the offender reasonably relied on a final judgment of a competent court of last resort that a provision making the conduct in question criminal was unconstitutional.