def callback(line):
    seq = line['seq']
    doc = line['doc']

    if doc.get('doc_type', None) == 'Thing':
        obj = Thing.wrap(doc)

    elif doc.get('doc_type', None) == 'Lending':
        obj = Lending.wrap(doc)

    else:
        # we also have other types of documents - _design docs
        return

    print '{:5d}  {:s}  {:s}'.format(seq, line['id'], obj)