Makes it an affirmative defense that the defendant acted within the provisions of a valid court order granting the defendant legal custody or visitation rights obtained pursuant to the Uniform Child Custody Jurisdiction Act (current law) or the Uniform Child Custody Jurisdiction and Enforcement Act.