A rewrite of the shepherd API in Python