How does mistake of fact or law serve as a legal defense to a crime?