To shelve an object, first import the module and then assign the object value as follows:

import shelve 
database = shelve.open(filename.suffix) 
object = Object() 
database['key'] = object