Whenever on the trial of an accused person it appears that upon a criminal prosecution under the laws of the United States, or of another state or territory of the United States based upon the act or omission in respect to which he or she is on trial, he or she has been acquitted or convicted, it is a sufficient defense.