tools: Replace duplicated code in mime-maker.