I found a procedure to do this described step-by-step at the ArcGIS Discussion Forums.
I recommend that you use that to perform each step manually first, and at the same time use Copy As Python Snippet in the Geoprocessing | Results window to start building the Python script for automation.
I would use Python by preference but it may also be amenable to ModelBuilder.
I have not checked whether all tools mentioned in the procedure are now available in Python but some were originally written in VBA. If not, you may need to spawn an extra question or two to "cross each bridge as you come to it".
If you are successful in developing this I think it would be a great candidate for packaging and posting to the Analysis and Geoprocessing Tool Gallery.