Convert sync-docroot to python

Also hoist common message handling code into AbstractSync to make
implementations simpler.

Change-Id: I08ec8e987225b8e7fb1ae2119a4623383cba4db7