the program offers options to addeditlistremoveimportand export dvd data we will skip importing and exporting the data from and to xml format since it is very similar to what we have done in and apart from addingwe will omit most of the user interface codeagain because we have seen it before in other contexts def add_dvd(db)title console get_string("title""title"if not titlereturn director console get_string("director""director"if not directorreturn year console get_integer("year""year"minimum= maximum=datetime date today(yearduration console get_integer("duration (minutes)""minutes"minimum= maximum= * db[title(directoryeardurationdb sync(this functionlike all the functions called by the program' menuis passed the dbm object (dbas its sole parameter most of the function is concerned with getting the dvd' detailsand in the penultimate line we store the key-value item in the dbm filewith the dvd' title as the key and the directoryearand duration (pickled together by shelveas the value in keeping with python' usual consistencydbms provide the same api as dictionariesso we don' have to learn any new syntax beyond the shelve open(function that we saw earlier and the shelve shelf sync(method that is used to clear the shelve' internal cache and synchronize the disk file' data with the changes that have been applied--in this case just adding new item def edit_dvd(db)old_title find_dvd(db"edit"if old_title is nonereturn title console get_string("title""title"old_titleif not titlereturn directoryearduration db[old_titledb[title(directoryeardurationif title !old_titledel db[old_titledb sync(