decode function in python script