code cleanup for python module