Add common code for python