This should be simple by using the same function as in the conversion script, refactor this into common functionality. cc @elisabethkoert