Misc python utilities