python general utility routines