General purpose tools for python