Add a couple of handy functions for python