(a) Nonliability.--Nothing in this chapter shall impose criminal liability:
(1) For acts committed during any abortion or attempted abortion, whether lawful or unlawful, in which the pregnant woman cooperated or consented.
(2) For the consensual or good faith performance of medical practice, including medical procedures, diagnostic testing or therapeutic treatment, the use of an intrauterine device or birth control pill to inhibit or prevent ovulation, fertilization or the implantation of a fertilized ovum within the uterus.
(3) Upon the pregnant woman in regard to crimes against her unborn child.
(b) Defenses.--In any prosecution pursuant to this chapter, it shall be a defense that:
(1) The use of force that caused death or serious bodily injury to the unborn child would have been justified pursuant to Chapter 5 (relating to general principles of justification) if it caused death or serious bodily injury to the mother.
(2) Death or serious bodily injury to the unborn child was caused by the use of force which would have been justified pursuant to Chapter 5 if the same level of force was used upon or toward the mother.