def wrap_draft(item):
 item.is_draft = (item.location.revision == MongoRevisionKey.draft)
 item.location = item.location.replace(revision=MongoRevisionKey.published)
 return item

def wrap_draft ( item ) : item . is_draft = ( item . location . revision == MongoRevisionKey . draft ) item . location = item . location . replace ( revision = MongoRevisionKey . published ) return item
cleans the items location and sets the is_draft attribute if needed .