porting set_release.sh to a python function

Can't test atm as factory is not snapshottable