A Mathematical Model of Uterine Dynamics and its Application to Human Parturition