For anyone else who might encounter this issue who is using Python 3.13 and macOS.
In Chapter 13, under section Shelve, you may encounter the following error:
error: db type could not be determined
and in the subsequent cell:
NameError: name 'db' is not defined
FIX is to amend the following cell:
import shelve
db = shelve.open(db_file, 'c')
db
To this:
import shelve
import os
db = shelve.open(db_file, 'n', writeback=False)
db
Following the official Python docs for shelve.open