Can someone help with this python script

I was able to do what I needed in a UtilityBlueprint