programs we can also use the underlying pickle module to serialize instances to flat files and other file-like objects ( network sockets)but the higher-level shelve module also gives us convenient keyed-access storage medium for instanceconsider the simple class shown in example - which is used to model people in hypothetical work scenario example - pp \dbase\person py (version " person objectfields behaviorclass persondef __init__(selfnamejobpay= )self name name self job job self pay pay real instance data def tax(self)return self pay computed on call def info(self)return self nameself jobself payself tax(nothing about this class suggests it will be used for database records--it can be imported and used independent of external storage it' easy to use it for database' recordsthoughwe can make some persistent objects from this class by simply creating instances as usualand then storing them by key on an opened shelvec:\pp \dbasepython from person import person bob person('bob''psychologist' emily person('emily''teacher' import shelve dbase shelve open('cast'make new shelve for obj in (bobemily)store objects dbase[obj nameobj use name for key dbase close(need for bsddb here we used the instance objectsname attribute as their key in the shelve database when we come back and fetch these objects in later python session or scriptthey are re-created in memory exactly as they were when they were storedc:\pp \dbasepython import shelve dbase shelve open('cast'list(dbase keys()['bob''emily'print(dbase['emily']print(dbase['bob'tax() reopen shelve both objects are here callbob' tax shelve files