this should probably go into buildbot.util (if not already the case)