How do I constrain the track-to actuator?

I am using a track-to actuator to track a target which changes based on different conditions. I only want it to track in an up-down direction within a 50-90 degree area. I also want to keep the tracking object from pointing backwards, rotating oddly, or going insane. Is there an easy way to do this, probably with python.