Various helpful python functions