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.
document that it's possible to return "", nil for some cases?