A person who executes or assists in executing any sentence, process, or warrant which purports to be passed or issued by a court or justice or other person, and who would be justified in executing the same if it had been passed or issued by a court, justice, or person having authority to pass or issue it, is not criminally responsible for any act done in such execution, notwithstanding that the court or justice or person had no authority to pass the sentence or issue the process or warrant, if in such execution he acted in good faith and in the belief that the sentence, process, or warrant was that of a court or justice, or other person having such authority.