Small improvement in python script