python utility code snip