def serialize(obj, fields=None, invalid=ABORT):
    pyobj = OrderedDict({
        'model': obj._meta.model_name,
        'fields': {}
    })
    for field in obj._meta.fields:
        if fields is None or field.name in fields:
            if field.serializable:
                try:
                    value = field.serialize(obj)
                except ValidationError:
                    if invalid == SET_EMPTY:
                        value = field.empty_value
                    elif invalid == IGNORE:
                        value = getattr(obj, field.name)
                    else:
                        raise
                pyobj['fields'][field.name] = value

    return pyobj
return the document which has the id
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/serializers/python.py/serialize--crossover with--dataset/ETHPy150Open namlook/mongokit/mongokit/document.py/Document.get_from_id