The anydbm module provides a generic interface that’s used to open a database without knowing which of the lower-level database packages are actually installed and available. When imported, it looks for one of the bsddb, gdbm, or dbm modules. If none are installed, the dumbdbm module is loaded.
A database object is created using the open() function:
open(filename [, flag=’r’ [, mode]])
This function opens the database file filename and returns a database object. If the database already exists, the whichdb module is used to determine its type and the corresponding database module to use. If the database doesn’t exist, an attempt is made to create it using the first installed module in the preceding list of database modules. flags and