util code in python