SLIDER-153 refactor .py script slightly for use elsewhere