Some random python utility code that I have written (or gathered)