In any prosecution under section 230.00, section 230.03, section 230.19, section 230.20, subdivision 2 of section 230.25, subdivision 2 of section 230.30 or section 230.34-a of this article, it is an affirmative defense that the defendant's participation in the offense was a result of having been a victim of compelling prostitution under section 230.33 of this article, a victim of sex trafficking under section 230.34 of this article, a victim of sex trafficking of a child under section 230.34-a of this article or a victim of trafficking in persons under the trafficking victims protection act (United States Code, Title 22, Chapter 78).