WIP: Add a utility for doing master election via etcd.

Sending this for comment, will work on unit tests once people are happy with the code.
OK, it makes more sense now. Can you add a verbose comment to this effect? And also a comment containing the description of the algorithm that you wrote in IRC earlier. For some reason just reading the raw etcd calls is not very clear.