import datetime import lima # a model class Book : def __init__ ( self , title , date_published ): self . title = title self . date_published = date_published # a marshalling schema class BookSchema ( lima . Schema ): title = lima . fields . String () published = lima . fields . Date ( attr = 'date_published' ) book = Book ( 'The Old Man and the Sea' , datetime . date ( 1952 , 9 , 1 )) schema = BookSchema () schema . dump ( book ) # {'published': '1952-09-01', 'title': 'The Old Man and the Sea'}