Python re/shelve/random