Move mk_livestatus functionality into a separate lib